• 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 is "SLOW!" How to measure it?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many people still claim that java is slow. What does that really mean? Have any experienced java programmers out there done any "real" performace tests or stats against other OO languages such as C++ or C#? Does the JVM spec document anything related to performance.
 
Ranch Hand
Posts: 1934
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From pure device level numbers: good c or c++ program may outclass good java code.

You have to look at the 'Good' part in my statement. Because people can write filthy c or C++ code that can make a good Java code better.

In gereral usage applications(like client/server + web based)Java has definite advantage with tremendous open source + talent pool support. You can not go wrong with choosing Java over C or C++ in these cases.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by tom chansky:
Many people still claim that java is slow.



Here is a paper with several benchmarks that shows Java as fast or faster than C++ as well as some discussion as to the validity of benchmarks and why people believe java is slow despite evidence to the contrary.
 
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is a site i posted on a different thread that compares all the major computer languages benchmarks.

benchmarks

You can see that C++ is way way faster (and it makes sense), but java runs the same as C#.
Scripting languages are way behind...

2 last notes:
This is done with java 1.4.2 which is 30%-40% slower than tiger/mustang.
The C# is the mono version and not the MS one but still...
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've read of benchmarks where Java was faster than C! Some people regard C as some sort of absolute limit, like the speed of light: E = mc^2. Hmm...
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Roy Ben Ami:
Here is a site i posted on a different thread that compares all the major computer languages benchmarks..



... that's pretty bogus. Where's the Java code, and how were the programs executed? The only code they show is the C++ code, and the only command line options they show are the g++ ones. Perhaps the Java code is less than optimal, and perhaps they're not using appropriate VM parameters.

Anyway, let's go have this argument in the Performance forum.
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As you can read in that site here]
and here, they don't persume to be 100% accurate.

They do however use the same algorithm in every language and measure only the CPU time.

I find that the results make sense to me and pretty reliable.
You can always optimize each language code to maximum but in the real world we don't do that.

Anyway, no need to take those results as they are from the bible...
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've had to do a lot of performance tuning, and if there
is anything I've found it is that with Java the specifics
matter a lot more than the generalities.

Five or six years ago that wouldn't have been as true,
but Hotspot and JVM internals have changed so much that
how you construct a performance comparison test
completely determines the results you get. If the test
doesn't match what you are doing, the conclusions are
100% useless. Not close. Not good enough most of the time.
Just useless. You really have to keep that in mind when
reading articles that try to compare other languages to Java.
The conclusions could be either completely accurate or
completely irrelevant to you, but most of the time they'll
be irrelevant. Doesn't mean they aren't interesting,
but they won't be much of a predictor for anything.

The articles may have one use though. I suspect that
any time an article comes out that spots a particular
feature of Java as being slow, a later Sun JVM
probably comes out that fixes the issue. Definitely
that happened with reflection and string operations.
[ January 12, 2006: Message edited by: Reid M. Pinchback ]
 
There are 29 Knuts in one Sickle, and 17 Sickles make up a Galleon. 42 tiny ads in a knut:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic