lol 14 times !!! I thought it would be max one second, wow c# great !!! the only thing that is better in java and I mean ONLY thing is better portability.
@smoku46 This is version 1.5, since then they've added concurrent garbage collection, JIT, and numerous other improvements that should have been around since launch day. It would be interesting to see how the current version of Android compares in this test.
I still can't fathom why they wanted to deploy java on these android devices for anything running on a vm. google really fell down on that one im afraid.
Good test, you'll also note that the numbers are very close to similar tests on desktop. Android Java virtual machine is good but Java performance is poor across all platform. C# is doing very good for a managed language.
@MavmDox Well C++ seems to make more sense to me. I don't know why, but how you code just seems more organized and it seems to make more sense. Maybe I'm just crazy :D. (I've coded both Java and C++, but I'm not very advanced at C++ yet (two months of practice))
It's just that nothing is fast enough to run a powerful program like Java. Java also does take up a lot of unnecessary memory, like garbage disposal (or whatever it's called) though...
What about assembler? And what if i will use perfoated cards to program this device? Will it be faster? I think you wrote something wrong in your java code or your java skill is poor. Too many dynamic types or something,.... Java can not be so slow compared to .Net. For sure not 10x slower LOL.
@sinni800 No that was just as an example. I think Java is easier to program in than C# but I am not sure of any speed differences. Perhaps on certain platforms Java has the upper advantage in speed.
I did notice that Java was faster on Linux than C# and Mono .NET. If that means anything...
@sinni800 Hahaha unless you consider Caffeine a drug...
No I was just exposed to Java many years before C# so.. it's an opinion thing.
I always was a bit of a Masochist though so I have no problem programming large applications in assembly. Hell I even dabbled in "brainfuck" before I decided that was to much pain.
@TheLizardGamer Not really. Just takes a bit of thinking. Once you understand it, it's quite easy and fun. :) Send me a message if you wanna learn some. ;)
This was Android 1.5 -- If you can test this again on Android 2.3 or at least 2.2 and release all the code you're testing with for review, that could give this test credibility. Otherwise, I'm not buying it that easily.
Your statement about 14 times the battery life because C++ is 14 times faster than Java is incorrect. The CPU is not the only factor in battery life. Backlight and network usage are two big factors as well. But you're on the right track - it would have a big impact on battery life when you have more than an order of magnitude better performance.
Just like Steve Jobs said: “Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain.”
Using Java is just not worth it on mobiles because of it's sheer size, uses lots of power and because it cannot take advantage of the native OS itself just like Obj-C can with iPhone OS or C# with Windows.
On the other hand Java is free and has A LOT of developers so thats what makes it so famous if you ask me.
@Omgwtfbfgsauce i guess u dont know why ppl program in java, its becus u dont need a OS to run it c++ need a OS to run. also java is good for intenet programming and its alot easyer to program in (fucking noobs) why i say this to u is cuz Steve Jobs kinda sucks
@jorreerroj Really, the only thing is that Java is easier and Java is cross-platform.
However, I feel that Java is very verbose. Also, Sun hasn't bothered to solve some inherent problems in the language, making it inefficient and slower.
From a programming standpoint, Python is the best, as you don't need to declare variables, and is overall much simpler.
But speed and performance is all important to the end user. No one cares how much better it is if there is an alternative that is faster.
@starrodkirby i just have to say java sucks... so do steve jobs right, tho why do java sucks its realy slow but why is it slow cuz java corrects the program while it runs thats why its so slow.
just have to say, i think c/c++ is alot better, cuz its low lvl programming. phyton is mutch higher lvl and this makes it slower
@starrodkirby cuz. high lvl programming languages cant program the PCU. exampel: java uses Virtual matchen to run. the easyer programming languages u use, ur getting to far avay from the pcu to get the speed. if u want speed use assembly thats harcore!
@jorreerroj BECAUSE ASSEMBLY LANGUAGE IS TOTALLY PRACTICAL
Why do great programmers use higher level languages?
So that they can think about actual program design rather memorizing where you left your damn variable or dredging through code that takes forever to make and debug.
@jorreerroj The major advantage of higher level programming is that it works on multiple platforms.
I don't want to have to learn 3 programming languages to work on 3 different processors.
Then again, every person has different needs. I prefer to focus on program design. You may focus on speed. Therefore, our languages that we use should obviously be different.
@starrodkirby lol C/C++ works on all platforms u just have to compile them on the platforms, the only problem is if u use MS VC++ cuz that compiler got som libs that only works on MS thats why ur not programming in MS, and btw higher lvl programming cant do the same as low lvl languages. btw i have programmed some in ASSEMBLY thtas fun. well i just saying if ur programming in C/C++ u can do. yea everything if ur programming on hih and mid lvl programming LANGUAGE u cant! and if u say u can, FU!
@jorreerroj Yeah, but I have different needs. Speed is not as important to me as what the code does. For me, programming is something on the side. So I prefer to take less time coding and more time using the code.
You may be different. Whatever, we need both types of people in the world.
@jorreerroj Never mind. I was just thinking about the huge ass enterprise system the team I work with is building. It's overkill. All those "enterprise" things I've seen are expensive and troubled. So the discussion here about what is faster - I don't know, it has no point. It all comes down to people not being able to really figure out what the need and how to code it efficiently. Speed of the implementing language is not going to help much in the end.
@starrodkirby If you consider C++ and C together, they are almost twice as popular as Java. C++ is a more portable language (not considering APIs). However, your argument is further hurt by the fact that Android does not use standard Java libraries, but proprietary APIs, thus even that advantage is lost.
For game development, C++ is king. My same game engine will run under Android, iPhone and Windows Mobile (pre Windows Phone 7, which is C# only for now). And performance-wise slaughters java.
Be interesting to see this speed comparison for Android 2.2, Froyo, with the Just In Time (JIT) compiling. For completeness I would also like to see the test for Mono with the graphical interface they promised was coming.
Problem with the awesomeness of assembly and C++ is that you have to compile a binary for the specific architecture, may be faster and more energy efficient but Google chose compatibility...
sigh, i dont speak good english so i probably worded wrong? im not saying you need to knwo it down to the core.... jsut the basics, understand? liek not everything specifically about the cpu/gpu, and thats not the main topic....
umm, most of the time, speed isnt why they use the language, it what people feel comfortable with. in C++ you have to know your interfaces, like CPU, GPU, etc; java you dont. Try to dig up a bit more knowledge first before posting. (words not meant in a (nasty?) way)
@ajk321 You don't know much about programming. The whole point of C++ is that it is CPU and GPU independent. Only the compiler must know what platform the final code will be run on. Also, speed is a huge reason to choose a language, if you don't think that a factor of 8 matters when it comes to performance you need to talk to Google. They have shown they even a few milliseconds of latency can make the difference between a pleasant page visit and an unpleasant one.
because you can wright java code much faster and it is much easier to learn. Also the compiled code is system unspecific since it runs in its own virtual environment.
i totally agree with justinl81's comments. You cannot compare Java to C++ that way. Simple reason .. Android is using the Dalvik JVM and not the Sun JVM. So that is already a big mistake in how you do comparison ..
this isn't a java issue, and c# was less than ideal but it performed fine
java and c# are usually within 80% of c++ with an optimized jit compiler
this video demonstrates that the current system of translating java into dalvik opcodes and then running that on dalvik is a very poor java implementation for performance
you can blame sun for their mobile profiteering, java still isn't open for mobile platforms so a direct java vm can't be used, that's why this dalvik nonsense is being used
You can't compare C++ native with managed languages such as C#/java first of all. Secondly if you're a a professional developer you know something about JIT and ASM you wouldn't won't say stupid things like C++ is more optimized. as for the missing rendering GFX thread, I agree.
First off put the ball into C# code for this to be a fair comparison. Second C++ is going to kick both their asses no matter what. What do you expect when comparing a complied/optimized language vs. byte-code/Jit languages? Of course the C#/Java fanbois will always come up with excuses as to why C# /Java is slow in any given case, but I've seen this song and dance over and over and C++ always wins. That's why C++ is still popular even with the advent of the newer uber-languages.
I agree that c++ will be faster because of the JITCing, but only on the first cycle. Assuming Mono was written to spec, all subsequent cycles will be run in machine code, just like c++. There must be a bug in the Mono implementation.
Java will always be slower because there will always be a vm involved.
No it won't. I've done tons of tests. A JIT does not optimize anywhere near C++ speed. If you are lucky you can bring C# up to one third the speed. Go test it yourself.
As speed of the application is limited by the algorithm calculating prime numbers, mono can dramatically increase application speed. It will be very good to see winforms implementation for android.
I call BS! Demo is clearly not the same for Mono as for Java/Dalvik and C++.
Staggering performance difference between Java + C++, but Mono should be left out of this test until you have an equivalent implementation that hooks into the Android UI.
as you can see in the java application the speed of the application is obviously limited by the prime number algorithm and not by the green circle moving around.
If there is a Android UI toolkit available to c++ then porting it to c# is trivial, achieving similar graphical performance. (you only have the wrapper overhead)
then why is java one of the top programming languages?
kootenaytech 2 hours ago
This proves that java sucks and always will.
specialfxmaker 4 days ago
lol 14 times !!! I thought it would be max one second, wow c# great !!! the only thing that is better in java and I mean ONLY thing is better portability.
smoku46 1 month ago
@smoku46 This is version 1.5, since then they've added concurrent garbage collection, JIT, and numerous other improvements that should have been around since launch day. It would be interesting to see how the current version of Android compares in this test.
VictorsChipsInc 1 month ago
Mono for Android is expensive :(
nullpointerE 1 month ago
I still can't fathom why they wanted to deploy java on these android devices for anything running on a vm. google really fell down on that one im afraid.
SinistaN 1 month ago
c++ vs galaxy s2
sotomayormathias 1 month ago
Good test, you'll also note that the numbers are very close to similar tests on desktop. Android Java virtual machine is good but Java performance is poor across all platform. C# is doing very good for a managed language.
huguesbc 1 month ago
machine code pwns asm
bagyslavak 2 months ago
stiff neck!!
TrainerScoobyDoo 2 months ago
ASM owns all
flyingtotheorbit 3 months ago
ooough my neck!
sarademil 3 months ago
Delphi for Android will be soo fast like C++
cuz its native! =)
galdariah 5 months ago
get a life!
madvax 5 months ago
C++ For the win ;)
vudarksky 6 months ago 16
@vudarksky true but it's hard to code, hard to maintain the code in c++
MavmDox 1 month ago 2
@MavmDox Well C++ seems to make more sense to me. I don't know why, but how you code just seems more organized and it seems to make more sense. Maybe I'm just crazy :D. (I've coded both Java and C++, but I'm not very advanced at C++ yet (two months of practice))
flyingcoasterfan 3 hours ago
synthetic test of cource but good enough
puchenyaka 6 months ago
THIS TEST IS FLAWED
DarkBit666 7 months ago
@DarkBit666 might i suggest you tell why?
Petoj87 6 months ago
@Petoj87 of course.
DarkBit666 6 months ago
It's just that nothing is fast enough to run a powerful program like Java. Java also does take up a lot of unnecessary memory, like garbage disposal (or whatever it's called) though...
mjiscool99 7 months ago
let every body choose the language he like for me i will pic c# because its a balance between speed and coding time
imspikey 9 months ago
What about assembler? And what if i will use perfoated cards to program this device? Will it be faster? I think you wrote something wrong in your java code or your java skill is poor. Too many dynamic types or something,.... Java can not be so slow compared to .Net. For sure not 10x slower LOL.
kurrator1 1 year ago
@kurrator1 You would be surprised, ive seen Java code run more than 60x slower than machine code. Java is a horribly slow programming language.
WaterEclipse911 11 months ago
@WaterEclipse911 Call me a speed freak (not the drug) but I would rather use C++ and inline Assembly rather than use Java or even C#.
autonomous2010 11 months ago
@autonomous2010 >implying c# is slower than java?
sinni800 8 months ago
@sinni800 No that was just as an example. I think Java is easier to program in than C# but I am not sure of any speed differences. Perhaps on certain platforms Java has the upper advantage in speed.
I did notice that Java was faster on Linux than C# and Mono .NET. If that means anything...
autonomous2010 8 months ago
@autonomous2010 Java is easier to program in? Drugs, much? ;D
sinni800 8 months ago
@sinni800 Hahaha unless you consider Caffeine a drug...
No I was just exposed to Java many years before C# so.. it's an opinion thing.
I always was a bit of a Masochist though so I have no problem programming large applications in assembly. Hell I even dabbled in "brainfuck" before I decided that was to much pain.
autonomous2010 8 months ago
@autonomous2010 Lol, Brainfuck is a difficult as hell language
TheLizardGamer 7 months ago
@TheLizardGamer Not really. Just takes a bit of thinking. Once you understand it, it's quite easy and fun. :) Send me a message if you wanna learn some. ;)
glitchygames 3 months ago
You should release the source code of all 3 apps.
Dessimat0r 1 year ago
@Dessimat0r I second that. Show us code!
kurrator1 1 year ago
This was Android 1.5 -- If you can test this again on Android 2.3 or at least 2.2 and release all the code you're testing with for review, that could give this test credibility. Otherwise, I'm not buying it that easily.
brokenthorn15 1 year ago
Your statement about 14 times the battery life because C++ is 14 times faster than Java is incorrect. The CPU is not the only factor in battery life. Backlight and network usage are two big factors as well. But you're on the right track - it would have a big impact on battery life when you have more than an order of magnitude better performance.
oisact 1 year ago
Just like Steve Jobs said: “Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain.”
Using Java is just not worth it on mobiles because of it's sheer size, uses lots of power and because it cannot take advantage of the native OS itself just like Obj-C can with iPhone OS or C# with Windows.
On the other hand Java is free and has A LOT of developers so thats what makes it so famous if you ask me.
Omgwtfbfgsauce 1 year ago
@Omgwtfbfgsauce i guess u dont know why ppl program in java, its becus u dont need a OS to run it c++ need a OS to run. also java is good for intenet programming and its alot easyer to program in (fucking noobs) why i say this to u is cuz Steve Jobs kinda sucks
jorreerroj 1 year ago
@jorreerroj Really, the only thing is that Java is easier and Java is cross-platform.
However, I feel that Java is very verbose. Also, Sun hasn't bothered to solve some inherent problems in the language, making it inefficient and slower.
From a programming standpoint, Python is the best, as you don't need to declare variables, and is overall much simpler.
But speed and performance is all important to the end user. No one cares how much better it is if there is an alternative that is faster.
starrodkirby 1 year ago
@starrodkirby i just have to say java sucks... so do steve jobs right, tho why do java sucks its realy slow but why is it slow cuz java corrects the program while it runs thats why its so slow.
just have to say, i think c/c++ is alot better, cuz its low lvl programming. phyton is mutch higher lvl and this makes it slower
jorreerroj 1 year ago
@jorreerroj Why can't we have both ease of programming and high performance?
Someone should look into that...
starrodkirby 1 year ago
@starrodkirby cuz. high lvl programming languages cant program the PCU. exampel: java uses Virtual matchen to run. the easyer programming languages u use, ur getting to far avay from the pcu to get the speed. if u want speed use assembly thats harcore!
jorreerroj 1 year ago
@jorreerroj BECAUSE ASSEMBLY LANGUAGE IS TOTALLY PRACTICAL
Why do great programmers use higher level languages?
So that they can think about actual program design rather memorizing where you left your damn variable or dredging through code that takes forever to make and debug.
Otherwise, I'd say you've got a good point.
starrodkirby 1 year ago
@jorreerroj The major advantage of higher level programming is that it works on multiple platforms.
I don't want to have to learn 3 programming languages to work on 3 different processors.
Then again, every person has different needs. I prefer to focus on program design. You may focus on speed. Therefore, our languages that we use should obviously be different.
starrodkirby 1 year ago
@starrodkirby lol C/C++ works on all platforms u just have to compile them on the platforms, the only problem is if u use MS VC++ cuz that compiler got som libs that only works on MS thats why ur not programming in MS, and btw higher lvl programming cant do the same as low lvl languages. btw i have programmed some in ASSEMBLY thtas fun. well i just saying if ur programming in C/C++ u can do. yea everything if ur programming on hih and mid lvl programming LANGUAGE u cant! and if u say u can, FU!
jorreerroj 1 year ago
@jorreerroj Yeah, but I have different needs. Speed is not as important to me as what the code does. For me, programming is something on the side. So I prefer to take less time coding and more time using the code.
You may be different. Whatever, we need both types of people in the world.
starrodkirby 1 year ago
@starrodkirby i said just that.... for like 10 comments ago :P
jorreerroj 1 year ago
@jorreerroj I can see you developing enterprise sized application in assembler. Then, 1000 years later, you have a login screen.
dante4d 1 year ago
@dante4d but thats a pro login screen.... :P
jorreerroj 1 year ago
@jorreerroj Well, maybe big systems that are fashionable today aren't as smart idea as it seems...
dante4d 1 year ago
@dante4d sry dont get it...
jorreerroj 1 year ago
@jorreerroj Never mind. I was just thinking about the huge ass enterprise system the team I work with is building. It's overkill. All those "enterprise" things I've seen are expensive and troubled. So the discussion here about what is faster - I don't know, it has no point. It all comes down to people not being able to really figure out what the need and how to code it efficiently. Speed of the implementing language is not going to help much in the end.
dante4d 1 year ago
@dante4d okey i just think that C/C++ is better then C# cuz its low lvl programming....
jorreerroj 1 year ago
@starrodkirby If you consider C++ and C together, they are almost twice as popular as Java. C++ is a more portable language (not considering APIs). However, your argument is further hurt by the fact that Android does not use standard Java libraries, but proprietary APIs, thus even that advantage is lost.
For game development, C++ is king. My same game engine will run under Android, iPhone and Windows Mobile (pre Windows Phone 7, which is C# only for now). And performance-wise slaughters java.
oisact 1 year ago
Be interesting to see this speed comparison for Android 2.2, Froyo, with the Just In Time (JIT) compiling. For completeness I would also like to see the test for Mono with the graphical interface they promised was coming.
Problem with the awesomeness of assembly and C++ is that you have to compile a binary for the specific architecture, may be faster and more energy efficient but Google chose compatibility...
dabestdefense 1 year ago 2
Yeah awesome comparison. Java as an Activity, C++ As some website and c# with out drawing, which costs a lot. Very fair indeed...
MrSnowCore 1 year ago
Java is for the layman, c++ is for the assembly-high level language hybrid person
AravindMathman 1 year ago
sigh, i dont speak good english so i probably worded wrong? im not saying you need to knwo it down to the core.... jsut the basics, understand? liek not everything specifically about the cpu/gpu, and thats not the main topic....
ajk321 1 year ago
Java sheep
RedClownKnight 2 years ago
umm, most of the time, speed isnt why they use the language, it what people feel comfortable with. in C++ you have to know your interfaces, like CPU, GPU, etc; java you dont. Try to dig up a bit more knowledge first before posting. (words not meant in a (nasty?) way)
ajk321 2 years ago
@ajk321 You don't know much about programming. The whole point of C++ is that it is CPU and GPU independent. Only the compiler must know what platform the final code will be run on. Also, speed is a huge reason to choose a language, if you don't think that a factor of 8 matters when it comes to performance you need to talk to Google. They have shown they even a few milliseconds of latency can make the difference between a pleasant page visit and an unpleasant one.
Eatporktoo 1 year ago 2
@ajk321
you clearly dont know what u are talking about, why would we have to know about the gpu, cpu if we are only writing userland applications?
Jumbomasters 1 year ago
Assembly unarguably. Speed isn't everything in the programming world
ea6b607 2 years ago
because you can wright java code much faster and it is much easier to learn. Also the compiled code is system unspecific since it runs in its own virtual environment.
ea6b607 2 years ago
i agree with justinl81's comments. You cannot compare Java using Dalvik against C++. That is already a big mistake to begin with.
abcdesdsf 2 years ago
i totally agree with justinl81's comments. You cannot compare Java to C++ that way. Simple reason .. Android is using the Dalvik JVM and not the Sun JVM. So that is already a big mistake in how you do comparison ..
abcdesdsf 2 years ago
this isn't a java issue, and c# was less than ideal but it performed fine
java and c# are usually within 80% of c++ with an optimized jit compiler
this video demonstrates that the current system of translating java into dalvik opcodes and then running that on dalvik is a very poor java implementation for performance
you can blame sun for their mobile profiteering, java still isn't open for mobile platforms so a direct java vm can't be used, that's why this dalvik nonsense is being used
justinl81 2 years ago
"java and c# are usually within 80% of c++ with an optimized jit compiler"
Bwaaaaaahahahahahahaha! That's good! Tell me another!
jabberwock11 2 years ago
You can't compare C++ native with managed languages such as C#/java first of all. Secondly if you're a a professional developer you know something about JIT and ASM you wouldn't won't say stupid things like C++ is more optimized. as for the missing rendering GFX thread, I agree.
glamoureus 2 years ago
it would be nice if there is the visual part of the green ball in c# code to see if the speed is faster.
ajflorido 2 years ago
Wow, comparing apples and oranges here. Good job, you seem to know it all... NOT!
MikeHart66 2 years ago
First off put the ball into C# code for this to be a fair comparison. Second C++ is going to kick both their asses no matter what. What do you expect when comparing a complied/optimized language vs. byte-code/Jit languages? Of course the C#/Java fanbois will always come up with excuses as to why C# /Java is slow in any given case, but I've seen this song and dance over and over and C++ always wins. That's why C++ is still popular even with the advent of the newer uber-languages.
jabberwock11 2 years ago
I agree that c++ will be faster because of the JITCing, but only on the first cycle. Assuming Mono was written to spec, all subsequent cycles will be run in machine code, just like c++. There must be a bug in the Mono implementation.
Java will always be slower because there will always be a vm involved.
psgivens 2 years ago
No it won't. I've done tons of tests. A JIT does not optimize anywhere near C++ speed. If you are lucky you can bring C# up to one third the speed. Go test it yourself.
jabberwock11 2 years ago
As speed of the application is limited by the algorithm calculating prime numbers, mono can dramatically increase application speed. It will be very good to see winforms implementation for android.
drejtube 2 years ago
haha! i can bet that javascript running in their browser will be faster than dalvik...
crustms 2 years ago
I call BS! Demo is clearly not the same for Mono as for Java/Dalvik and C++.
Staggering performance difference between Java + C++, but Mono should be left out of this test until you have an equivalent implementation that hooks into the Android UI.
stephanfeb 2 years ago
as you can see in the java application the speed of the application is obviously limited by the prime number algorithm and not by the green circle moving around.
If there is a Android UI toolkit available to c++ then porting it to c# is trivial, achieving similar graphical performance. (you only have the wrapper overhead)
tincoandringa 2 years ago
but its not java
MrMcQ2u 2 years ago