View Single Post
Posts: 2 | Thanked: 5 times | Joined on Oct 2009
#66
Originally Posted by Bratag View Post
So you want speed and java. Yeah thats not going to happen. As an android coder who also codes in C I can tell you there is no comparison in performance. The reason java coders hate to code in C is because it forces you to think about memory allocation and freeing and that goes against the " throw everything into memory and let garbage collection sort it out " mentality that most Java coders have.

Trust me the surest way to take something fast and hobble it is chuck Java into the mix. Here is an example.

I have a pixel by pixel filter I compiled on my G1 in C and also the same filter in Java. The C version runs in 2 seconds on a selected image, the Java version takes 20 and on top of that half the time it craps out because the jvm runs out of memory.

Take from that what you will I guess
Unfortunately a lot of people, like you, think that there is a jvm in the Android platform. The vm used in Android is called Dalvik and it is not a jvm. The only thing Java about Android is the syntax and the syntax has little to do with performance. Thus your example has no relevance in the Java discussion.

The most important thing lacking in the Dalvik VM is a JIT. The difference in speed has been measured to 5-10 times faster with the JIT. The actual speed naturally depends on what you do but a better figure to use is that Java runs at about 80% of the speed of native programs.

If you had read all of my post you would have noticed that I see the need for some programs and parts of programs that run on the native platform.

However most applications are not image filtering and why would you want to to manage the memory of simple data lookup and entering app?

I think we have all see all those great C developers that "know" how handle memory of apps the leak memory, forcing us to restart the app regularly. A large number of security holes are due to developer that cannot handle a simple buffer overflow. I guess we have to expect a huge increase in mobile worms in the future.
 

The Following 2 Users Say Thank You to bcaroll For This Useful Post: