On Jun 9, 5:40 am, Gavin Aiken <[email protected]> wrote: > On Tue, Jun 9, 2009 at 7:55 AM, David Turner <[email protected]> wrote: > > Why are you using static class variables instead of locals in the Android > > Quicksort example?They are considerably slower to access.
> Because, I'm very new to this :) Also I read this; > > http://developer.android.com/guide/practices/design/performance.html#... > > If I have misinterpreted the meaning I'll go change the source. Anything > else to make it fairer would be greatly appreciated. See "Cache Field Lookups"? I'm not sure that's what digit was referring to though -- the weird thing I see is in the C code, where some things that should be locals are stored in global variables. The way the code is written can emphasize or de-emphasize the difference between interpreted code and JITted code. With a literal- minded compiler like javac, and a straightforward interpreter, the effects of your coding choices will be very apparent. Throw ProGuard and a mature JIT into the mix and you can use less-efficient constructs without paying a price. The notion of "fair" doesn't really enter into the way it's coded. You're not measuring the performance of the VM in general; you're measuring the performance of your code as it executes on different platforms. If your code were, say, a popular physics engine, then you could draw some interesting conclusions about how games based on your engine would perform, and possibly about integer or floating-point math-intensive operations in general. You wouldn't be able to say too much about how a dynamic language would perform though, or how sorting a massive array would perform. So the only place "fairness" counts is in how you characterize the results. It's perfectly reasonable to write the Java code in the most inefficient way imaginable and then race it against HotSpot to show the effects that a mature desktop JIT can have. The trick with any benchmark run is figuring out what the results really mean. Re: blindfold: "Can you quantify the "vastly slower" Dalvik interpreter? Is it the factor 5-10 that one typically finds?" You're thinking of JIT vs. interpreter. Native code is another multiplier on top of that. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
