Java is 50% slower than C++

Discussion in 'Game Development (Technical)' started by bvanevery, Sep 4, 2007.

Thread Status:
Not open for further replies.
  1. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    Oh, and for Jake2 I'm getting 85 FPS on a 3.2GHz Pentium 4 with an ATI Radeon X300 on Windows XP. I've got both JRE 1.5 and 1.6 available, I don't know enough about Java to know how it goes about differentiating them. To give the Bytonic guys the benefit of the doubt, I'd say I haven't reproduced their benchmarking methodology yet. I wonder if I'll be able to, since I'm using both a faster computer and a faster 3d card than they used.
     
  2. Diragor

    Original Member

    Joined:
    Jul 27, 2004
    Messages:
    293
    Likes Received:
    0
    Not that there was ever a question or a real invitation to a debate that would be heard with an open mind, but allow me to interrupt the pissing match with a response to the original statement: Who cares? If you do, use C++.
     
  3. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    So what benchmarks do you get for Jake2-0.9.5?
     
  4. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    The real debate is simple, even if delivered as a flame. Java nuts say Java is as fast as C++ for everything. I say it isn't and that's why chunks of the 3d industry won't touch it.

    I look at benchmarks, some Java people look at benchmarks. We debate benchmarks. The people who don't have any benchmarks and are only capable of snide remarks are useless. That doesn't mean there's no debate though.

    Some Java people want to convert newbies to Java rather than C++. I don't have any problem with that if it's based on correct information about the strengths and weaknesses of the languages.

    I'd be quite happy to see real evidence that Java does in fact equal the performance of C++ for compute intensive tasks. So far, the benchmarks I've seen that attempt to demonstrate that, smell funny. Goading people is a way to get information out of them. Some people put a lot more effort into making their case when they don't want to be wrong.
     
  5. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    It's 3 am and I've had enough of this crap for now. By "crap" I mean, ID's Quake2 3.21 code doesn't build on XP, their demo doesn't install on XP, various people's Quake II ports don't work any better. This is proving to be a difficult benchmark to duplicate and I'm losing motivation. One last stab at Google to see if anyone's already discussed Jake2 performance ad nauseum.
     
  6. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
  7. Teq

    Teq
    Original Member

    Joined:
    Sep 16, 2004
    Messages:
    228
    Likes Received:
    0
    What is the point in this thread? Perhaps I missed it, just seems to be a rant about how poor Java is when compared to C++ in the performance arena? Java tends to be easier to manage and (from my experience) has less pitfalls, that is worth the drop in performance in my book.

    Lets face it Object Orientated languages rarely wear the performance crown anyway and I can't see many developers dropping back to Assembly or machine code just for the sake of an extra couple of frames...
     
  8. cliffski

    Moderator Original Member

    Joined:
    Jul 27, 2004
    Messages:
    3,897
    Likes Received:
    0
    man, I am seriously disappointed not to see cas here, FIGHT!!!!!

    I do agree with the poster on one side issue though. Not all indie games are completely unconcerned about performance. We are not ALL making bettys beer bar clones here. For some of the code in some of my games, performance is mega mega critical. If you are talking about casual puzzle games, please call them casual puzzle games, do not lump us all in together.
     
  9. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    Ok, Q2 demo worked on Vista, surprise surprise. I finally figured out how to turn off vsync. I have a 2GHz Intel Centrino Duo, GeForce 8600M GT with crappy drivers. My JRE is 1.6 OEM Sun Microsystems.

    In windowed mode:
    640x480: Q2-3.16 gets 225 FPS, Jake2-0.9.5 gets 100 FPS.
    1280x960 : Q2-3.16 gets 165 FPS, Jake2-0.9.5 gets 100 FPS.

    I can't duplicate the claims of the Bytonic benchmark. The performance difference is in line with other C/C++ vs. Java benchmarks I've seen. I am not inclined to believe their claims without corroboration from other sources.

    And with that, I sleep. It is 4:45 am and my work is done for today. Er, yesterday.
     
  10. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    Yes there are career points to be made. C++ leads you in certain directions, Java leads you in other directions. For newbies, there's more to a career than shipping their own indie games. They may want to work in the game industry for a time before striking out on their own. They may want to work in related industries such as 3d graphics as consultants. As far as the data I've seen, there are factual reasons why Java hasn't taken over everywhere. Yes there are a lot of things you can get done in either C++ or Java just fine. Yes you can get some productivity advantages with Java, for many types of problems. But not all problems. Performance optimization jocks have good reasons for going the C++/ASM route, it's not just cultural brainwashing or people being stuck in their ways. People like myself have monitored the performance of Java on and off for more than a decade. Our choices are going to be grounded in technical reality until Java's performance does indeed match C++ in all respects.

    Right, sleep. 5 am.
     
  11. Oaf

    Oaf
    Original Member

    Joined:
    Jul 30, 2004
    Messages:
    136
    Likes Received:
    0
    Who cares. This muppet's getting all worked up over nothing. You're only making him feel important, instead of the sad little man that he really is.

    [And no, I'm not a Java advocate. I used to be, but after 12 years of using Java on the desktop I think Flash has finally won the day. Which, as far as I know, has worse performance issues than Java. Having said that, C++ is a horrible bodge of a language.]

    So if we all keep quiet, and slowly back away, perhaps Mr C++ can be alone and happy in his little world.
     
  12. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    Meh, although i dislike the way bvanevery writes his posts, my findings with Quake2 vs Jake2 show that Jake2 is indeed slower.

    Jake 2 rendering some scene
    Quake 2 rendering the same scene (the fps counter up there is some generic opengl-based counter i wrote a few months ago)

    Although that rate justifies what the Bytonic people are talking about: Jake2 is around 60% as fast as Quake2.

    Note: my system is an Athlon64 3200+ with ATI X850XT PE and 1.5GB of memory, running Linux 2.6.20 in 32bit mode.
     
  13. ChrisP

    Indie Author

    Joined:
    Feb 5, 2007
    Messages:
    971
    Likes Received:
    0
    And yet the Java version works straight out of the box. I guess it can't be all bad. ;)

    (Sorry, sorry. I'm teasing. I know that this is not the topic at hand.)
     
  14. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    Set your monitor refresh rate to 60Hz and try again.

    Cas :)
     
  15. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    What continually amazes me is how bvanevery doesn't get that everyone knows Java is slower already but that the difference between 60fps and 90fps is irrelevant. It smacks me as a total failure to understand the desktop games market.

    You have a wide range of CPU and GPU architectures out there to cater for: ranging from 300MHz CPUs in some ancient Macs with TNT2s in all the way to dual-core Athlons at 3GHz each with 9700GTs. There's a curve of distribution.

    If you've got a title that needs absolutely utterly cracking FPU performance - and it's almost certain you haven't because you're an indie - then it will run at 100% of your desired speed on a certain level of hardware and achieve 60FPS. Let's say you want it to run OK on at least 50% of all the computers out there in your market, that's, say, 1.5GHz CPUs. That's how you write games.

    Let's say it was written in Java and achieved a lowly 85% of the framerate (realistic). To get it to run as fast you'll be needing a CPU that's 1.76GHz instead. Looking at the curve of distribution you'd note that only 45% of the computers out there have a CPU that's fast enough.

    Then you take into consideration that you may not actually be worried that it acheives 60FPS (the optimal case) and are indeed happy with it running at 45FPS (like most 3D games). So in reality you can safely target machines running at only 1.3GHz. Your market increases to 55% of all the machines out there using Java, or @ 1.1GHz using C++, 60% of all the machines*

    That's basic market research you need to undertake before choosing a tool. Evidence suggests you'll get between 50-85% of C++ speed using Java when you're maxing out the CPU. There are some circumstances which will get Java up to 100% of the speed of C++ but by and large it won't happen.

    The second decision you need to focus on is how much time it takes to develop your software. Even the die-hard C++ programmers will have to grudgingly agree that it takes about two-thirds the time to get something finished in Java as it does in C++. Can you afford to increase your development time by 50% in order to increase your market penetration by 10%? That is the question you need to ask yourself. Is your time better spent marketing the product than chasing another 10FPS?

    So, give over with the "Java is slower than C++". We know that. We just find that for any realistic situation the performance gap makes no difference.

    Cas :)

    * Hypothetical figures. Actual figures are available from Steam where you can play around with the figures
     
  16. Nikster

    Original Member

    Joined:
    Jul 27, 2004
    Messages:
    698
    Likes Received:
    0
    Not sure why people bother comparing ports either, especially as it's whoever is doing the port can improve/worsen results by the usage of different techniques, hell you can even offload the pixel pushing to the hardware of the graphics card, and with the age of q2 many advances of techniques/algorithms etc are common place.

    A decent java programmer can produce better results than a shitty c++ programmer given the correct context, just comparing a tightloop of a math function over a million iterations is pointless.

    So I guess the moral of the story is, we are now slashdot ;)
     
  17. electronicStar

    Original Member

    Joined:
    Feb 28, 2005
    Messages:
    2,068
    Likes Received:
    0
    Please get a real job.
     
  18. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    Actually on Vista it can be. Jake2 did not work out of the box, there was some .bat file permissions problem during the install. There's no "Run As Administrator" menu for a .jar file. I learned how to start a command prompt as Administrator, then do java -jar blahblah.jar from the command line.

    I don't have any problem with a claim that Java can get 60% of the performance of C++. That's what I'm seeing. To be honest even that surprises me, given Java's historical reputation, but I guess it is 2007 rather than 2001. My point is that there are problem domains where a 40% loss of performance is not commercially acceptable. It's a disservice to newbies to pretend like it is.

    I can't take seriously that I'm in a "sad little world" for caring about such things. Rather, I've got standards for truth and quality in engineering, and I'm willing to fight for them. I'm only willing to use the less performant solution if it's appropriate to do so. When I'm doing CMake scripting, it's jolly appropriate to be as bloated as I like. When I'm doing performance oriented 3d, it's not. Yes there's such a thing as lightweight 3d, and Java can handle that, but that's not what everybody is doing.
     
  19. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    But it is in here. This is the Indie gamer developer forum. You want to take this argument to gamedev.net where it belongs. Nobody in this forum cares. What we care about is writing good games and making profit.

    Cas :)
     
  20. bvanevery

    bvanevery New Member

    Joined:
    Jun 25, 2007
    Messages:
    369
    Likes Received:
    0
    I have one of those. I work from home, get paid really well, and work whatever hours I like. The tradeoff is sometimes it really bores me, so I indulge in something I'm more passionate about. Now if I could just find that kind of passion in my current build problems. I'm hardly devoid of passion for build engineering, otherwise I would never have coughed out the Chicken CMake build, nor gotten hired for my current gig. But it's such a slog I can't maintain the passion all the time.

    Yeah, so, some of you don't like my posting style. But see, the thing is, so far, I'm right. And that's the important thing, what is right. What's good engineering and what isn't. The poster who came up with the Jake2 benchmark did a really good job of contributing to the debate. It looked like it might support the Java crowd's contentions. But it's interesting what happens when you actually try to reproduce other people's benchmarks. You find out how careful they really were. I'd like to know how the Bytonic guys got the "Java is as good as C++ in some cases" numbers. They don't match what I'm seeing or what Bad Sector has seen. If more people would use benchmarks instead of getting into "personality issues" about this stuff, we'd have the full truth of it in short order.
     
Thread Status:
Not open for further replies.

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer