Hi, I am partway through re-implementing my some of my game logic in C++; the find-next-move code for a board game. The algorithm does a reasonable amount of work, evaluating approximatly 1.1 million terminal positions during a game.
The C++ code is currently running between 6 and 8 faster than the same algorithm implemented in Java. I was not happy with the speed of my Java code which had already been optimized (using information from the performance analysis tools) and I had pre-allocate all the objects needed (outside the game loop) so as to avoid GCs. I have not yet had time to look at optimizing the C++ code and the timings I have are from the C++ debug build vs the Java release build. So I think there is a little bit more still to come. I am testing on and HTC Magic running Android 1.6 On Aug 19, 1:54 pm, Fabrizio Giudici <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On 8/19/10 14:33 , Amit wrote: > > > Well yes, I only meant that just the fact of using native code > > (over Java) won't be very effective. At least that is the > > impression I have (which may be wrong). > > > Considering the fact that even native code ultimately runs inside > > the Dalvik VM instance, performance gains from use of native code > > would be modest, right? > > Things are a bit different. As far as I understand, applications in > general only run inside the Dalvik VM - which means that e.g. > activities, boot code etc... is bytecode. In other words, a 100% > native app can't exist in Android. But the NDK allows you to create > portions of native code that are called by the app. That is, a flow of > operations is always started by the VM, but your native code gets > executed directly on the processor. This is more or less the same that > happens with JNI in the regular Java JDK. > > Given that, before moving to native code I'd wait for others to share > with you their experience specifically with image processing. > > PS It's a shame that Google dropped some imaging back-end classes from > Harmony, as there are a number of powerful and complete imaging > libraries in Java such as JAI. > > - -- > Fabrizio Giudici - Java Architect, Project Manager > Tidalwave s.a.s. - "We make Java work. Everywhere." > java.net/blog/fabriziogiudici -www.tidalwave.it/people > [email protected] > -----BEGIN PGP SIGNATURE----- > Version: GnuPG/MacGPG2 v2.0.14 (Darwin) > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/ > > iEYEARECAAYFAkxtKYAACgkQeDweFqgUGxdg6wCgpJM/beTx9U0thsO30tjNh0Mp > lOUAnRRBs/XxM9PutV+7KOh7CoLGehE8 > =bXS+ > -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en

