Java Speed tests

Started by
32 comments, last by Thaynx 23 years, 11 months ago
I posted this in the Java Programming section but thought it would be worth everyone seeing it...... OK, to all of you that keep singing the party song about java will always be slower that c++ because it is not compiled code, stuff this in your compiler! Here is a site that did some serious speed comparisons with matrix math. http://www.intergalact.com/java/speedtest/speedtest.html (I would say that that is a good testing ground) and the following is the results! Matrix inversion Compiler/runtime N = 50 N = 100 N = 150 N = 200 MS VC++ 4.0 0.88s 2.97s 8.57s 20.49s MS J++/MS Jview 0.33s 2.31s 6.7s 15.65s Cafe/Cafe Java 0.55s 3.24s 10s 23.07s Sun Javac/Sun Java 4.51s 32.03s n/a n/a Matrix multiplication Compiler/runtime N = 50 N = 100 N = 150 N = 200 MS VC++ 4.0 0.16s 1.2s 4.34s 12.36s MS J++/MS Jview 0.16s 0.88s 3.18s 9.61s Cafe/Cafe Java 0.22s 1.37s 4.99s 14.28s Sun Javac/Sun Java 1.86s 15.1s n/a n/a For the people that sing the party line (and the ones that are praying for better performance) here is great news (or bad, depending on how you look at Java), the new generation JIT compilers are getting great performance! This test didn''t even use the fastest JIT! Granted, the graphics speed may not quite be there, I will concede that (for now). But by the time we start releasing our games (year or two from now) the added machine speed and better JIT''s will more than make up for the that. Happy Java programming! If you can''t win, make sure the one that beats you breaks the record!
If you can''t win, make sure the one that beats you breaks the record!
Advertisement
Yeah, JIT can be fast.
Microsoft has their own J++ compilers, those are MS-defined Java, not the SunMicrosystem one. See the results of both Cafe and Sun Java? They''re both slower than MS VC and MS J++ so if you''d better don''t use Sun''s Java for game programming purpose. Java is not meant for games.
If they got better JIT, why don''t they use it? Don''t trust them man, they''re just telling lies. Games programming, best tool is known to be C and ASM language.
I''d like more than matrixes. I''d like to se a full-blown game. 2D and 3D. With the final release settings set, not with all of the debug code in. Also, take into consideration that Java has to be downloaded, compiled, and run every time, and C++ has to be compiled once for each platform, and downloaded once for each computer. Take that in account, and you can see why players prefer pre-compiled games. And discounting graphics as "well, computers will be faster, and it won''t be noticable soon" is much farther from the truth than you think. Until we get to the point where everybody has a supercomputer capable of making realistic, photographic 3D scenes in 1/60th of a second, the fact that C++ holds an edge in graphics performance will always attract gamers. And don''t bet everything you''ve got on your JIT compilers. You''ve only tried one C++ compiler! Puh-lease. I really don''t think the test is as fair as it sounds. Try the others, and stop bragging about how good your (really unfair) test is.
"If a man does not keep pace with his companions, perhaps it is because he hears a different drummer. Let him step to the music he hears, however measured or far away"--Henry David Thoreau
I am laughing my butt off over here!

>>Don''t trust them man, they''re just telling lies. Games programming, best tool is known to be C and ASM language.

Do you realize how stupid that statement is? First, "I know that Java is slower (because everyone says so, but I wont actually try it myself) so it all must be lies! Second, "everyone knows C and ASM is the best (and always will be the best, because that is "the way I''ve always done it") so nothing can ever be better! Seems like someone said that once....hmmm....something about the earth being the center of the universe and that was "a known fact"....who was that....oh yeah....THE ROMAN CATHOLIC CHURCH!(and they killed people over it!)

As far as CobraA1 (at least you put your name to your post, I respect that and will be a little nicer!), I understand your point completely.
>I''d like more than matrixes. I''d like to se a full-blown game. 2D and 3D.
Well, right now I don''t have that for you, but lets think for a second. What is at the heart of a 3d game? I would propose the 3D engine. Do you agree? What is at the heart of 3D engines? Just a power hungry algorithym that crunches numbers (grossly understated, sort of). Well doing math with matrices is just that, CRUNCHING NUMBERS.

To everyone out there, I am not trying to tear down the good old faithfull C, C++, and ASM! All I am saying is, "Don''t sing the party line if you haven''t done the tests for yourself!" Just a little bit ago, I ran these tests myself (and quite honestly, it was hard to believe), but the numbers don''t lie. Some of us will remember back when we programmed with punch cards. I knew others that didn''t want to move to ASM the way it is today! Then I knew others that didn''t want to move to C, then C++, then Java (but I digress....). Lets get out of our comfort zones and check things out ourselves.

p.s. I don''t mind getting flamed or harsh responses to this, as a matter of fact I welcome it, challenge me. Just make sure if you do, be a man (or woman) and don''t be Anonymous, that is just a way of hiding (pretty wimpy).




If you can''t win, make sure the one that beats you breaks the record!
If you can''t win, make sure the one that beats you breaks the record!
I forgot one question that I have for CobraA1, what do you mean that the Java has to be downloaded time after time? Do you really know anything about Java, or are you just blindely repeating what you have heard from other people that don''t know what they are talking about either. You are talking as if I would write a game as an applet! Applets have to be downloaded time and time again. Someone would have to be crazy to do that. There are no JIT''s for applets (that I know of, I could be wrong). BUT, you can write applications that are download once, run as many times as you would like! The applications are the ones that I am speaking about. (Just to set the record straight)

If you can''t win, make sure the one that beats you breaks the record!
If you can''t win, make sure the one that beats you breaks the record!
...and not even applets have to be downloaded time after time. Download a jar and an html page that launches the applet, and you''re all set.
I don''t see any reason to think that Java couldn''t be just as fast as C++. Java''s just little more then compressed C++ code. Computers only take a few seconds to compile a C++ program, why can''t it compile a Java program the same way, but in memory? (Some other "interpreted" languages to this too)

I can also see why the Java ran a little faster in some of the tests. With C++, you have more overhead. The programmer has a little more control, and libraries and header files might have unused code. Java has been very well written as a language.

The best thing about Java as a game language is it''s cross platform capabilities. Just think of the market you can reach if by just writting your program once, you can reach the IBM, Mac, Amiga and any other game platforms. Who knows, maybe they''ll soon have a Java game system you hook up to your tv. Just insert a flash memory card or CD with the program on it.

But I''m not writting a game in Java yet because of how easy it is to decompile back to the original code. Variable names and all.

E:cb woof!
E:cb woof!
Just a comment Thaynx,

I know that Netscape 4.72 uses the Symantec JIT-compiler. You can see this by opening the Java console when opening an applet. I am not sure about Internet Explorer, though, but it runs as fast as netscfape so I think that it contains a JIT too.

And by the way, you should net be calling people stupid all the time. I propmotes hostility. We should keep the discussion serious. That is most fruitful for all.
Jacob Marner, M.Sc.Console Programmer, Deadline Games
felonius I agree with you that I should not have called people stupid or anything like that. I have emailed several people already about this to say that I am sorry, but let me make it public.

My purpose was not to be ugly (although it was) but to promote my findings.

My appologies to all.

If you can''t win, make sure the one that beats you breaks the record!
If you can''t win, make sure the one that beats you breaks the record!
I don''t see how a Java program can outperform a C++ one that was done properly. Equal, yes, beat, no. A JIT optimiser can only really perform the same sorts of operations than a standard optimiser could do. I''d be interested to see the source code, as I wonder if the C++ isn''t using suboptimal language features (for example, something like passing by value rather than const reference). And I would agree that matrix math is only a small part of a program, and only really part of 3D games which are still not everything. And even that math is being offloaded to the video card bit by bit...

This topic is closed to new replies.

Advertisement