• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java vs C++

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is perhaps a very general question but only considering performance how does Java 1.4.1 compare to C++? I've heard mixed reports and generally that Java is still behind but how far behind? I had a quick look on the internet but couldn't come up with any good articles.
Thanks
James
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no one correct answer.
You can write a poorly designed/implemented program in either language that would suck compared to a well designed one in the other.
The languages are different and have different features, characteristics, and stuff. So a 1-1 bake-off is not really easy to do. But that doesn't stop people from trying (and often the point they want to make is predetermined).
There are some things that C/C++ is much better at, and some that Java is really good at.
One advantage that Java has actually used to be a disadvantage. The Class file format in Java makes it an interpreted language. Interpreters are traditionally slow, and so was Java in its 1.0 days. But hotspot and similar technologies have really helped recently - letting the runtime dynamically tune the code based on measured performance. In C++, you have to do this at compile-time.
And IMHO, the language itself and availibility of APIs and other features can make development and maintainence much less of a burden than with other languages.
But the real question is not which is faster - if you want pure fast, then you should write in Machine Code.
The real question should be "Is Java fast enough for the job at hand".
US$ 0.02,
Dave
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Amen Dave!!!
Why must people continue to compare languages. :roll:
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In some other forums, I have seen too many C/C++ advocates come on, say how they hate Java, how slow it is, etc. Drives me nuts.
You pick the right tool for the job. Java fits most jobs nicely.
As an example, I don't believe, even with JDK 1.4 and hardware accelleration, I would write a game in Java. I definitely wouldn't write real-time specific apps, like music applications (midi, audio mixing, etc) in Java if I planned on having a lot of capabilities (like unlimited audio FX, unlimited audio channels, etc). Device drivers are another thing that really have to be written at the native level and Java wouldn't be good for.
On the other hand, look at the war with MS .NET VS J2EE. There was an issue on this not too long ago on Java Developer Journal. The "demise" of Sun may very well be happening, but will Java be affected? Will .NET take over and the 3 million + Java developers have to switch? Not at all. Java is WAY too strong in the market with a much larger population of developers writing Java code than .NET. Sure some will convert, most of the time because their company decides for them and they have no choice. Sometimes because the truth is, most Java dev tools don't match up to .NET tools in areas like RAD development. BUT, look at all the "players" in J2EE. BEA, Oracle, IBM, HP, Allaire, Borland, Symantec, Rational Rose, and MANY more are all tightly nitted to Java/J2EE. Some of them also do .NET, like Borland.
Despite a recent crap performance test that MS paid for and hosted, most apps are far cheaper to deploy with Java IF you choose a reasonable server to do so. If you run out and pick up iPlanet from Sun at $25K per CPU, then yes, J2EE may be more expensive to deploy. But in terms of scalability, I believe J2EE has .NET beat hands down.
Ok, that was a little off topic. The point is, as the other poster said, there isn't any need to compare for speed. If you need ultimate speed for games and stuff, you use C, make a cross-platform game engine and go from there. It isn't "terribly" hard to do this, if managed correctl. If you want more manageable code which usually results in faster time to market, or faster updates and fixes, you go with Java. Well, even that may not be correct to say because skilled C/C++ developers know their code, so they can manage it fairly well. I still lay odds that reading and deciphering Java code is much easier than C/C++ code, maybe even .NET C# code.
 
What are you doing in my house? Get 'em tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic