Slashdot Mirror


Performance Benchmarks of Nine Languages

ikewillis writes "OSnews compares the relative performance of nine languages and variants on Windows: Java 1.3.1, Java 1.4.2, C compiled with gcc 3.3.1, Python 2.3.2, Python compiled with Psyco 1.1.1, Visual Basic, Visual C#, Visual C++, and Visual J#. His conclusion was that Visual C++ was the winner, but in most of the benchmarks Java 1.4 performed on par with native code, even surpassing gcc 3.3.1's performance. I conducted my own tests pitting Java 1.4 against gcc 3.3 and icc 8.0 using his benchmark code, and found Java to perform significantly worse than C on Linux/Athlon."

154 of 954 comments (clear)

  1. Trig functions... by eples · · Score: 3, Interesting

    I am not a compiler nerd (IANACN?), so maybe someone else can answer the following simple question:

    Why are the Microsoft languages so fast with the Trig functions?

    --
    I'm a 2000 man.
    1. Re:Trig functions... by Kingpin · · Score: 4, Funny


      They probably cheat and use undocumented native OS calls.

      --
      Unable to read configuration file '/bigassraid/htdig//conf/14229.conf'
      Geocrawler error message.
    2. Re:Trig functions... by bigjocker · · Score: 3, Insightful

      What is interesting in these functions is that, as pointed in the article, there seems to be something wrong with Sun's implementation for Java. Removing this test JDK 1.4.2 executes almost on par with Visual C++ (the winner).

      This is (once again) proof that Java is not slow, in fact it's really fast. It's slow starting, and yes, consumes more memory than native code, but the gained security, stability and ease of programming (reduced development times) are worth the memory use increase.

      Also, the memory use should be addressed by project Barcelona (I believe these will be available in the forthcoming J2SDK 1.5, along with generics, enums, etc).

      --
      Life isn't like a box of chocolates. It's more like a jar of jalapenos. What you do today, might burn your ass tomorrow.
    3. Re:Trig functions... by Dr.+Evil · · Score: 4, Insightful

      Don't forget that it is also percieved as slow since just about any application anyone has seen for a desktop environment written in Java has a sluggish GUI.

      Yeah, I know Java's strengths aren't in the Desktop arena, they're in development and the back-end.

    4. Re:Trig functions... by tealwarrior · · Score: 4, Informative

      What is interesting in these functions is that, as pointed in the article, there seems to be something wrong with Sun's implementation for Java.

      For many math functions java uses a software implementation rather than using the built in hardware functions on the processer. This is to ensure that these function perform exactly the same on different architectures. This probably accounts for the difference in performance.

      --
      In theory, there is no difference between theory and practice, in practice there is.
    5. Re:Trig functions... by hackstraw · · Score: 2, Interesting

      M$ is pretty tight with Intel (hence the term Wintel). They might have licenced or somehow gotten some code optimisers from Intel. On Linux, the Intel compiler is often 100% faster than gcc on double precision code (like trig functions).

    6. Re:Trig functions... by be-fan · · Score: 2, Informative

      Its not proof of anything. Its just proof that the JIT manages to handle JIT-ing properly. All of these were simple loops where the JIT could do its work and get out of the way for the rest of the program. They are not indicative of real-world performance, unless all you are doing are such loops.

      --
      A deep unwavering belief is a sure sign you're missing something...
    7. Re:Trig functions... by techiemac · · Score: 2, Informative

      One issue with Java is it all depends on the Virtual Machine.
      I, for one, would _never_ trust Java in a mission critical embedded environment. In fact you still see assembly in those envrionments from time to time. Imagine using Java for a fly by wire system. Would you fly on a plane that was using Java for fly by wire? I, for one, would not.
      Java is great for some things. But you get too many cases where companies use a new technology without adequate due diligence simply because its the NTOW (New Technology Of the Week). I still say that a server written in C (written properly of course) will outperform a server written in Java.

    8. Re:Trig functions... by mengel · · Score: 5, Interesting
      Probably the Microsoft languages use the Intel trig instructions.

      In the case of Java, you find that the Intel floating point trig instructions don't meet the Java machine spec. So they had to implement them as a function.

      It all depends if you want accuracy or speed.

      --
      - "History shows again and again how nature points out the folly of men" -- Blue Oyster Cult, 'Godzilla'
    9. Re:Trig functions... by csnydermvpsoft · · Score: 5, Informative

      If more people would use the SWT libraries (part of the Eclipse project) instead of the crappy AWT/Swing libraries, then this misconception would go away. SWT works by mapping everything to native OS widgets if possible, giving it the look, feel, and speed of a native app. I used Eclipse for quite a while before finding out that it is almost 100% pure Java (other than the JNI code necessary for the native calls).

    10. Re:Trig functions... by coats · · Score: 2, Interesting
      The Intel x87 uses Pade representations in hardware, accurate to IEEE REAL*10 EXTENDED, i.e., about 24 significant digits.

      Otoh, the P4 SSE2 uses a vectorized software model that doesn't have these; I don't know whether the MS compiler generates x87 hardware code or SSE2 vectorized software.

      Java specifies using a 32-bit model for these functions, and is probably doing them in software. But what software? And does it use the vectorized SSE2?

      --
      "My opinions are my own, and I've got *lots* of them!"
    11. Re:Trig functions... by Doomdark · · Score: 5, Insightful
      Don't forget that it is also percieved as slow since just about any application anyone has seen for a desktop environment written in Java has a sluggish GUI.

      It's in many ways unfortunate that with JDK 1.2 (Swing) and onwards, Sun pretty much dumped fast native support for GUI rendering. It has its benefits -- full control, easier portability -- but the fact is that simple GUI apps felt faster with 1.1 than they have done ever since (or even more). This is, alas, especially noticeable on X-windows, perhaps since often the whole window is rendered as one big component as opposed to normal x app components (in latter case, x-windows can optimize clipping better).

      Years ago (in late 90s, 97 or 98), I wrote a full VT-52/100/102/220 terminal emulator with telnet handling (plus for fun plugged in a 3rd party then-open SSH implementation). After optimizing display buffer handling, it was pretty much on par with regular xterm, on P100 (Red hat whatever, 5.2?), as in felt about as fast, and had as extensive vt-emulation (checked with vttest). Back then I wrote the thing mostly to show it can be done, as all telnet clients written in Java back then were horribly naive, doing full screen redraw and other flicker-inducing stupidities... and contributed to the perception that Java is and will be slow. I thought it had more to do with programmers not optimizing things that need to be optimized.

      It's been a while since then; last I tried it on JDK 1.4.2... and it still doesn't FEEL as fast, even though technically speaking all java code parts ARE much faster (1.1 didn't have any JIT compiler; HotSpot, as tests show, is rather impressive in optimizing). It's getting closer, but then again, mu machine has almost an order of magnitude more computing power now, as probably does gfx card.

      To top off problems, in general Linux implementation has been left with much less attention than windows version (or Solaris, but Solaris is at least done by same company). :-/

      --
      I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
    12. Re:Trig functions... by bigjocker · · Score: 2, Interesting

      One issue with Java is it all depends on the Virtual Machine.
      I, for one, would _never_ trust Java in a mission critical embedded environment. In fact you still see assembly in those envrionments from time to time. Imagine using Java for a fly by wire system. Would you fly on a plane that was using Java for fly by wire? I, for one, would not.


      Considering that the EULA forbids from using Java to operate Nuclear Plant and Air Traffic systems, you will never fly in a Java powered Boeing. But that's in the License, so your rant is useless.

      Java is great for some things. But you get too many cases where companies use a new technology without adequate due diligence simply because its the NTOW (New Technology Of the Week). I still say that a server written in C (written properly of course) will outperform a server written in Java.

      Of course, I can write every application only using 1s and 0s, avoiding every bloating in current programming languages and compilers. That's good and dandy for hobbyists and educational porpuoses. But when there's big $$ on the way you don't want to do that. Java suits those needs perfectly.

      In fact I have a feeling that after the release of project Barcelona (this will allow to have just one full set of Java classes to be loaded, with every additional VM using the shared classes, reducing the memory use by every new application) it will be very reasonable to rewrite every network service available on a linux machine using Java. Without buffer overflows, integer overflows and other insecurities inevitably present in pointer-based languages removed you could have an even more secure Linux system.

      --
      Life isn't like a box of chocolates. It's more like a jar of jalapenos. What you do today, might burn your ass tomorrow.
    13. Re:Trig functions... by CommandNotFound · · Score: 2, Informative

      Since you have 1.4.2 installed, try running the Java2D demo in $JAVA_HOME/demo/jfc/Java2D. The graphics are quite fast on a local machine, largely because (as you said) it uses back buffering to blast the pixels onto the screen. Unfortunately, this is horrible for remote X displays, but I found a workaround. Launch your java app with the option -Dsun.java2d.pmoffscreen=false, and this will disable the backbuffer and tremendously speed up remote X operation, at the expense of some flicker. On my remote machine, I renamed java to java.bin and created a wrapper script named java that always uses this option with the single line:

      exec $JAVA_HOME/bin/java.bin -Dsun.java2d.pmoffscreen=false $*

      That way any plugins or Web Start apps also get this treatment. Just make sure you also change the JRE copy of java, too.

    14. Re:Trig functions... by bigjocker · · Score: 4, Insightful
      This is a perfect example of why I don't like java. If I use java then I have to stick to the decisions made by someone else even if they are completely wrong for my situation. But you are free to use yor C/C++ optimized functions in Java. Just make a wrapper class and access them natively, just like Java does access a lot of Math functions:
      public static native double acos(double a);
      public static native double asin(double a);
      Those are from the
      StrictMath
      class, used by the
      Math
      class. You did know that you have access to Java libraries source code, didn't you? For real math/science stuff java is horrible For real math stick with Fortran, SciLab or Matlab. For Real Time applications use C. No language will suit all needs. Personally I develop enterprise applications using Java and Games using C. Also, what I find humerous is the whole NIO (new IO) stuff. basically Java started out using threads to deal with multiple IOs but due to scaling issues they developed 'new' IO which is basically the equivilent of select! Yeah thats real 'new'!!! The tradittional IO subsystem in Java was a traditional one: sockets, streams, buffers, etc. It Is very scalable, just look at the Tomcat, Jetty and JBoss project before NIO appeared. NIO is just an optimization for very specific tasks, for some stuff you still need a separate Thread for each connection.
      --
      Life isn't like a box of chocolates. It's more like a jar of jalapenos. What you do today, might burn your ass tomorrow.
    15. Re:Trig functions... by fuzzbrain · · Score: 3, Interesting

      SWT libraries use native widgets. I think the parent post is perhaps overstating the speed increase of SWT over the latest versions of Swing. The main thing I like about SWT java apps vs swing apps is that they fit into the rest of the desktop better. Another benefit is that SWT and gcj fit well together. Again the benefit here isn't so much speed as reduced download sizes for those users who don't have java installed already.

    16. Re:Trig functions... by happyfrogcow · · Score: 3, Informative

      SWT works by mapping everything to native OS widgets if possible

      Isn't that what AWT tried to do originally? I'm just delving into Java for the first time the last few months, but I thought I've read this in "Core Java, Vol. 1"

      They say (pg. 236 "Core Java, Vol. 1) that this resulted in a "write once, debug everywhere" problem since you will have different behavior, different limitations and different bugs on each implementation of AWT on each platform

    17. Re:Trig functions... by techiemac · · Score: 2, Interesting

      Considering that the EULA forbids from using Java to operate Nuclear Plant and Air Traffic systems, you will never fly in a Java powered Boeing. But that's in the License, so your rant is useless.
      I have knowledge of mission critical systems and I will tell you right now, just because the EULA forbids something, or its not certified, doesn't mean that doesn't happen. VXWorks is a very popular RTOS and used on flight systems but it's not "certified for flight systems". It was used on the pathfinder mission, but it was not space certified... etc.
      I'm not bashing Java here. I'm just saying that not enough due diligence is performed before people jump at a new technology (yes I know that Java has been around for many years). Java, IMHO, is used for applications that it should not be used for. There are different tools for different applications. Yes you can use a crecent wrench as a hammer, but why not use a hammer.
      I have seen many instances of technologys getting deployed because it's new and cool (and there are quite a few new and cool technologies that fit their applications) but sometimes things are deployed that are trying to fit a round peg and a square hole.
      In fact I have a feeling that after the release of project Barcelona (this will allow to have just one full set of Java classes to be loaded, with every additional VM using the shared classes, reducing the memory use by every new application) it will be very reasonable to rewrite every network service available on a linux machine using Java. Without buffer overflows, integer overflows and other insecurities inevitably present in pointer-based languages removed you could have an even more secure Linux system.
      It would probably not be a good idea to rewrite every network service avaliable on Linux in Java. Linix _is_ used in mission critical systems! Yes you may reduce the amount of buffer overflows but VMs are not immune to buffer overflows either. Nothing can make up for good programming practices. Besides C is still faster than Java and in my experience, works very well for OS level networking routines. Some people forget to cross their t's and dot their i's simply because we are human. That's why it helps to have a second set of eyes look at things and test your code (and test more even after that!).
      I'm not trying to bash you or Java here, I'm just trying to say that different tools have different uses.
      I doubt that there will ever be a one thing fits all applications. I'm remided of my programming languages class when the prof said "Here is assembly language, you will never have to use it". Guess what, 2 years later I was using it :)

    18. Re:Trig functions... by dnoyeb · · Score: 4, Interesting

      Just because Swing is slow does not make it crappy. It meets nicely what it was designed to do. I use swing applications all the time. Today we have 1GHz processors, its not even an issue any longer, but it wont be allowed to die...

      Eclipse is nice, I love eclipse. But I dont mistake it as a Swing replacement. AWT has a purpose, as does Swing and SWT, they are all different.

      I believe AWT should be as fast as SWT because its also natively implemented.

    19. Re:Trig functions... by ChannelX · · Score: 2, Informative

      I'm getting really tired of hearing this comment. First off SWT isn't anywhere near Swing in the functionality department. Not even close. Is it faster? Yes in *some* cases. In the cases where there isn't a native OS widget then it emulates the widget and you're then in the same area as Swing yet with a crappy API to boot. No thanks. Secondly, Swing is not slow if programming properly. I suggest looking at the interfaces of IntelliJ IDEA, the tools from JGoodies (http://www.jgoodies.com), or JEdit to see what is possible with a Swing UI that is programmed properly.

      By calling Swing a crappy library you show that you really haven't used it all that much if at all and are just puking tired, second-hand information.

      --
      My blog: http://jkratz.dyndns.org/~jason/blog/
    20. Re:Trig functions... by dnoyeb · · Score: 2, Insightful

      There's that, and the fact that MS does not have any "languages."

      On a realer note, the JVMs are written in "C" a fact that some people just don't seem to understand. A Java program when running is a form of a C program. Thus, their is no reason to have slower math functions except that the JVM was poorly written.

      The whole comparison of non-graphic Java to C or C++ is moot as C or C++ is the basis of all JVMs I know of.

    21. Re:Trig functions... by maraist · · Score: 2, Informative

      Just to elaborate.. The main advantage of NIO is when you anticipate an arbitrary number of threads..

      Conversely, when you have a finite number, 1-thread-per-stream asynchronous IO is VERY desirable; both in coding, and in some small ways even in efficiency (immeidate responses; limited only by context switching time).. In contrast, IO-multiplexing may have certain tasks take long periods of time (stalling other channels).. Then you have to manually keep track of such situations as you code and push them off to worker threads in certain types of problems.

      But there is simply no substitute when you want thousands of simultaneous idle connections (such as message servers) for IO-MUX.

      Not that it's better, just solves a particular solution.

      --
      -Michael
    22. Re:Trig functions... by Florian+Weimer · · Score: 2, Interesting

      Why are the Microsoft languages so fast with the Trig functions?

      Last time I did similar benchmark on Windows, the MSVC runtime library set the FPU control word to limit precision to 64 bits. Other environments on x86 used 80 bits precision by default, increasing computation time for some operations.

    23. Re:Trig functions... by Anonymous Coward · · Score: 2, Insightful
      On a realer note, the JVMs are written in "C" a fact that some people just don't seem to understand. A Java program when running is a form of a C program. Thus, their is no reason to have slower math functions except that the JVM was poorly written.


      What's your point? One could argue that any program when running is a form of machine code thus they should be running as fast as they possibily can. (Which is true of course!)
    24. Re:Trig functions... by Nova77 · · Score: 2

      Well, it is not that easy.
      Consider, as example, the memory menagment of the virtual machine. If you need to allocate 50 megs dynamically with C, the OS will look for the largest chunk of 50 megs; if it can't find it, it must set pointers on the fragmented ram. All this kind of work takes time. With java, the VM allocates all the ram at the beginning, and then menages it with intelligent algorithms, making the allocation sometime even faster than C.

    25. Re:Trig functions... by Darren+Winsper · · Score: 3, Informative

      Actually, I'm going to complain because you are completely wrong. Sun complained about Microsoft changing the language in a way that was incompatible with everybody else's implementation.

    26. Re:Trig functions... by jorleif · · Score: 2, Insightful

      The JVM might be written in C and be a native program, but it's still running the Java bytecode in a virtual machine. If the virtual machine does not have the math functions you mentioned as primitives their performance depends on the JVM/JIT-engine.

      So in a benchmark comparing compiler performance I can't see how that is "moot".

    27. Re:Trig functions... by nikster · · Score: 2, Informative

      Then you have not seen my Java apps. Everything i made in the last 12 months or so has been indistinguishable from native interfaces... I have been doing client app programming for the last 6 years. Java has come a long way since then. Sometime in 2002, the Java GUI was not slow anymore.

      The factors:

      1 - fast-enough machines (response time 1/10 second is not noticable - no one cares if that is 10x slower than native at that point. you can't see it.)
      2 - Improvements to Swing. 1.4 is the first version of Swing which has hardware acceleration built-in, thereby putting it on par with native win apps (native apps would be terribly slow without HWaccel, too - just turn it off in your graphics card settings to see how)
      3 - and, to a certain extent, enough memory in machines. Java is a memory hog (even a small client app uses 20M...). But that doesn't matter if your machine has 256M.

      You can say Swing is still overkill and over-engineered, and the AWT is no beauty, either. All true. Only, at this point, it doesn't matter. The "perceived suggishness"-barrier has been passed and left behind for good.

      If your Java GUI is sluggish in 2004, you have only yourself to blame.

    28. Re:Trig functions... by Abcd1234 · · Score: 4, Informative

      Sorry, dude, but SWT is nowhere *near* as complete as Swing, in terms of functionality. I know, I've tried to use it. Basically, because SWT was designed more or less specifically with Eclipse in mind, it has massive gaps in it's APIs (for example, the imaging model is *severely* lacking). Worse, it's difficult to deploy, and even more difficult to use, as the documentation is remarkably incomplete. So, as much as I hate to say it, SWT simply can't replace Swing right now, and I don't expect it to any time soon.

    29. Re:Trig functions... by William+Tanksley · · Score: 4, Informative

      Enumorators? Reflection?

      I'm only a beginner in C# and Java, but I know both have reflection, and the proposed Java 1.5 has enums. Kudos to C# for having them first :-), but Java 1.5 has them better, as first-class objects.

      Also .net/IIS is a better platform for webdevelopment.

      Better for whom? Why? Doesn't it have the severe shortcoming of platform lockdown?

      I can write a c#.net app in 1/4th the code of a java one. Go take a look at Microsoft's petshop program if you do not believe me.

      I can write an assembly app in 1/4 the code of a Python one. Assuming, of course, that the Python app wasn't written for small code size... The simile is very accurate; Sun didn't write their petshop for small size.

      The Java Petshop reimplementation here spanks both Sun's and Microsoft's petshop in terms of size, and pretty clearly demonstrates that both languages could do better.

      BTW, I absolutely love C# -- from what I've done with it so far. My only complaint is that its support is at best halfhearted for other platforms, and I will not allow my work to be tied down to one platform. This is the only thing that kept me from learning K (well, K is portable, the only problem is that it's only available from one vendor, Kx systems). Anyhow, I think C#'s bytecode is far beyond anything Sun's ever going to do with Java.

      ALso WIndows2k3 is as stable as Linux now. NT4 is old. The situation has improved dramatically. I have never even seen a blue screen on windows2k yet!

      I agree with all of that, but it's not enough. I have seen blue screens and system crashes on 2000 and XP (XP far, FAR FAR more often than 2000). But then I've seen system crashes on Linux, so I'm not just complaining about MS ;-).

      -Billy

    30. Re:Trig functions... by Antity-H · · Score: 2, Informative

      Nope, as the parent poster says, SWT uses the system widget. These are pretty high level calls such as : drawx a combobox with such and such properties at this position in reference to this frame.
      AWT/SWT only uses low level calls (probably as low as : draw this pixel at x,y with this color) and recreates all the widgets "from scratch". And if you ever have the time, go download the source code of java on sun's website (there is a community edition to download for free ) and take a look at the implementation of swings components, no wonder they are sluggish. I won't even get started on the focus management of swing which is "weird" to say the least.

    31. Re:Trig functions... by shemnon · · Score: 3, Insightful

      First off, SWT only performes well on windows, and stack on top of that that the principal native abstractions are taylored to a win32 environment. Based off of that it is easy to see how SWT performes quite nicely on Windows.

      Elsewhere it sucks. MacOS, GTK, photon, Motif. Even porrly writeen swing programs outperform on those platforms.

      But back to your FUD. Yes, bad programmers make ugly and poor performing GUI code. Swing is no different in that regard. But have you looked at recent swing programs in the 1.4.2 version of the JDK? Tried stuff like CleverCactus (a mail client)? Synced your MP3s on a new RIO? Used Yahoo's Site Builder to make a web site? There are excelent swing progams out there. Many you probobly don't realize are java swing apps!

      But since SWT is only in early adopter land we haven't seen the real dogs of GUIs it can make yet, especially since you have to do such arcane and ancient tasks in SWT as managing your own event queue! :( Give the same bad programmer SWT and you won't get a bad GUI instead you will get a non-fucntioning GUI.

      --
      --Shemnon
    32. Re:Trig functions... by Goldfinger7400 · · Score: 2, Interesting
      According to this O'Reilly's book that I just bought on Java, Java tends to be a little more sluggish because the code cannot be optimized by the compiler for the platform, except during runtime. With Java 2 they have the Just-In-Time optimization routines, so the longer you have the program running, the faster it gets supposedly. The interface will never be quite as snappy, but a Java application does have the potential to have good math performance if it runs for a long time, i.e. in an enterprise situation.

      And yeah, best way to improve performance would be writing a better virtual machine.

    33. Re:Trig functions... by Pieroxy · · Score: 3, Informative

      You are so wrong, that it is a shame you posted this one!

      AWT has native widgets: Combo box, menu, button, text area, input box, checkbox, etc... Not only primitives.

      What you are describing is Swing, not AWT.

      Swing relies on the most basic AWT features: Component/Container and drawImage, and re-implement the whole widget sets in Java, relying on these two AWT components.

    34. Re:Trig functions... by Raedwald · · Score: 2, Interesting
      For real math stick with Fortran

      Don't go there. it provides no real benefits.

      --
      Ne mæg werig mod wyrde wiðstondan, ne se hreo hyge helpe gefremman.
    35. Re:Trig functions... by be-fan · · Score: 3, Interesting

      Actually, this is a myth. Modern GC methods do not introduce a huge amount of overhead, when you take into account a few things:

      - Algorithms for allocating memory in a manual management scheme can be quite complicated. Look up on how large glibc's memory allocator is. Memory allocation algorithms for GCs tend to be much simpler, often as simple as a simple pointer increment.

      - Deallocation algorithms for manual memory management are often even more complicated than the allocation algorithms. They are nearly always slower. Plus, objects are deallocated one at a time. Deallocation algorithms for GC can be simpler, but most importantly, the GC can deallocate large numbers of objects at once. This is, of course, more efficient.

      - Copying GCs can compact holes in memory, which makes for better cache utilization.

      Depending on the problem at hand, a GC can be a little slower or about the same. For a functional programming style (which has a particular pattern of memory usage) GC is usually faster than manual management. For programs that tend to operate in phases, allocating large numbers of objects gradually and freeing them at once, GC will also be faster.

      The real problem with GC is that it affects latency. Modern GCs only freeze the app for a fraction of a second, but that's a large amount of time for something like a game or movie. There are some work arounds for this, though. Latency-sensitive apps can disable GC and use manual memory management. Or, they can use a real-time garbage collector, which has guaranteed latency, but does incur a large fixed overhead. Of course, these problems can be worked around, as evidenced by the fact that major PS2 games like Jak and Daxter were written in a GC'ed language (Common Lisp). Most proponents of GC will tell you that such work-arounds are a good deal easier than hunting down memory leaks and dangling pointers!

      --
      A deep unwavering belief is a sure sign you're missing something...
    36. Re:Trig functions... by Nurgled · · Score: 4, Insightful

      Faster processors should enable us to achieve more, not achieve the same old stuff much less efficiently.

    37. Re:Trig functions... by Skjellifetti · · Score: 3, Informative

      I seem to recall that if the platform doesn't have a widget that SWT needs, it uses its own implementation.

      Or just doesn't bother implementing it at all. Try printing from eclipse on Linux.

    38. Re:Trig functions... by tjansen · · Score: 2, Insightful

      >>Sorry, dude, but SWT is nowhere *near* as complete as Swing, in terms of functionality.

      Maybe, but most *users* will chose a SWT app over a Swing one anytime. Actually most users will refuse to use a Swing app, they feel strange and look ugly.
      The main reason for Eclipse's success (and the demise of the other free IDEs) is that only Eclipse offers a pleasant GUI, which no Swing-based IDE can.

    39. Re:Trig functions... by matfud · · Score: 2, Insightful

      Suns implementaion is only a reference implementaion. Other providers can provide faster/different implementaions.

      the reason for the slowdown between 1.3 and 1.4 is that 1.3 introduced a new class called StrictMath that provided better cross patform consistency the standard Math class. It was slower though. In 1.4 the standard Math class was rewritten so that internally it uses the StrictMath class.

      Other implementaions do not have to use this approach.

      matfud

    40. Re:Trig functions... by Milo77 · · Score: 2, Insightful

      "select" is actually very useful for the case where you might want more than *one* thread for a connection. in the case where a client is properly multithreaded, you can continue to receive requests even though previous requests haven't yet completed. the ideal solution is to have a thread pool, where a thread is assigned to incoming requests, not just an incoming connection. in the latter case you can get the situation where you may have 10 threads (one per connection), but only a single connection is getting hammered(and all client threads are being forced to wait on a single server thread - which is probably io bound). in the former case, you'll have 10 threads in a pool with no ties to any particular thread. when a single connection starts getting hammered, more threads can be assigned to serivce that single connection. Java's nio (and select) are perfect for implementing such a system. so, while select can be used as you suggest in order to decrease throughput, it can also be used as i suggest to increase it dramatically.

    41. Re:Trig functions... by be-fan · · Score: 2, Informative

      I don't think Java or C# do this, but more advanced GC'ed languages (Lisp/ML) have advanced compiler algorithms that will stack-allocate any objects they can.

      Its actually a pretty easy optimization: if a reference to a an object doesn't escape the current scope (which they can determine they usually analyze all or most of a program at the same time) then it can stack allocate the object.

      --
      A deep unwavering belief is a sure sign you're missing something...
    42. Re:Trig functions... by bhavebaby · · Score: 2

      Mail Clients, music managers, and simple web site builders are pretty basic programs. If you want to look at the performance of more complex programs, just look at the IDE's for these languages. Eclipse is much faster than net beans, uses about half the memory, and is a much better looking interface. Swing will never look as good as native components, and if you've ever developed in Swing, you can quickly spot other swing programs. Because it does not use native code it has to emulate the look and feel (usually it's ugly), and it has to manage it's own rectangles and events, making for a larger footprint and slower program. I used to be a die hard java fan, but after getting in the real world and working for a while I quickly saw that most companies want development for one platform, windows, and most companies do not purchase the entire company new equipment whenever a faster chip is released. The older ones are filtered down, and you end up developing for a 400Mhz Celeron which swing applications quickly render useless. Often times Java programmers have such closed minds and devout loyalty to Java that they quickly resort to poking their fingers in their ears, closing their eyes, and shouting "java is the best, java is the best" whenever someone mentions a decent alternative. Me, I've started writing in C#, and using Windows forms. They are fast, small, and a hell of a lot better looking than anything I've ever done in java (forget those crappy layout managers, absolute positioning and anchoring is all you need, I promise). So I was happy to see the benchmark results. One last thing, what are you talking about "manage your own event queue"? I worked with swt alot and I never managed my own event queue. Add an event handler, handle the event, that's all I ever had to do. I'm not saying your wrong here, I just never had to do that, and am wondering where it has to take place.

    43. Re:Trig functions... by cylab · · Score: 2, Informative

      And I refuse to use any IDE (like Netbeans) that uses Swing.

      sorry to say, but this is ignorant. eclipse is a great app and netbeans might have a sluggish gui, but i would not ditch an application because of its toolkit...

      a great example for a good swing-app is intellij idea and its a hell of an IDE (IMHO the _very_ best java-IDE _by far_) use it one day and you never want to go back to any other java IDE. its pure swing, looks good, feels good and is fast and responsive!

      yes, its commercial, but thats not the point in this discussion (but you can get a trial-licence, so i'd suggest to try it)

  2. Accurate? by Nadsat · · Score: 5, Interesting

    Not sure of the accuracy. Benchmark is on a loop:

    32-bit integer math: using a 32-bit integer loop counter and 32-bit integer operands, alternate among the four arithmetic functions while working through a loop from one to one billion. That is, calculate the following (while discarding any remainders)....

    It also relies on the strength of the compiler, not just the strength of the language.

  3. Why did VB do so bad on IO. by nberardi · · Score: 4, Interesting

    Why did VB do so bad on IO compared to the other .Net benchmarks? They were pretty much equal up until the IO benchmarks? Any chance of getting the code published that was used to test this?

    1. Re:Why did VB do so bad on IO. by enkafan · · Score: 5, Informative

      Because the guy who wrote the code decided to use the VB6 compatability features instead of the .NET runtime for VB. Why one would do this, I have no idea.

    2. Re:Why did VB do so bad on IO. by pr0c · · Score: 4, Informative

      VB.net compiles into the same thing as c#, it SHOULD have benchmarked the exact same and so there would have been no point.

    3. Re:Why did VB do so bad on IO. by enkafan · · Score: 2, Informative

      Assuming they wrote the same code, it would compile into the same IL. If you would have looked at the IO code in question, you'd notice this:

      C#

      StreamWriter streamWriter = new StreamWriter(fileName);
      while (i++ ioMax)
      {
      streamWriter.WriteLine(textLine);
      }
      streamWriter .Close();

      VB.NET
      FileOpen(1, fileName, Microsoft.VisualBasic.OpenMode.Output)
      Do While (i ioMax)
      PrintLine(1, myString)
      i += 1
      Loop
      FileClose(1)

      Totally different routines, totally different IL, totally different performance. If he'd had simply stuck to the .NET framework for the VB stuff, then they get the same IL.

  4. Re:Wow by finkployd · · Score: 3, Interesting

    Well, for performance it does. For cross platform compilation it rocks the house. If you really want performance you need to be using something like Intel's C compiler (which oddly was not tested)

    Finkployd

  5. Java Performing worse then C by ViolentGreen · · Score: 4, Insightful

    I conducted my own tests pitting Java 1.4 against gcc 3.3 and icc 8.0 using his benchmark code, and found Java to perform significantly worse than C on Linux/Athlon.

    Why is this a suprise? C has been most commonly used for so long because of it's speed and efficiency. I think anyone who has done much work with either developing or running large scale java programs knows that speed can definitely be an issue.

    --
    Not everything is analogous to cars. Car analogies rarely work.
    1. Re:Java Performing worse then C by Kingpin · · Score: 4, Insightful


      All that matters to anti-Java zealots is speed. The list of benefits coming from using Java is too long to take the speed-only view seriously.

      --
      Unable to read configuration file '/bigassraid/htdig//conf/14229.conf'
      Geocrawler error message.
    2. Re:Java Performing worse then C by csnydermvpsoft · · Score: 2, Interesting

      I think anyone who has done much work with either developing or running large scale java programs knows that speed can definitely be an issue.

      I would consider myself part of that "anyone," and I disagree with you. Other than load times (which aren't as bad as they used to be), Java can perform as fast or faster than C code. The main thing is to use a good VM - IBM's J9 VM significantly outperforms Sun's.

    3. Re:Java Performing worse then C by finkployd · · Score: 3, Insightful

      Not always though, I think the thing people neglect to consider is that there are times when performance and scale are important enough that the benefits of Java do NOT outweigh C, and vice versa.

      I feel sad for someone who only has enough room in their world for one computer language.

      Finkployd

    4. Re:Java Performing worse then C by Cederic · · Score: 2, Interesting


      Performance and scale are two different beasts.

      However, there are definitely times when some languages are more appropriate than others.

      Being mostly a one-language person (used to be guru level on others, but skills have lapsed) I restrict my development to the areas that language is strong in. And let people fluent in the other languages do the other work.

      For the things most people use Java for, speed isn't that important compared to the reasons they're using it.

      For people who need speed, maybe Java isn't the right choice. So pick something else and get on with it.

      For the example environment shown, i.e. writing software to run on windows, I'd pick Delphi anyway - all the speed advantages of C, many of the programming language niceties of Java, all of the front-end simplicity of VB. Delphi rocks for Windows development. Shame it wasn't also benchmarked..

      ~Cederic

    5. Re:Java Performing worse then C by Jerf · · Score: 2, Informative

      The list of benefits coming from using Java is too long to take the speed-only view seriously.

      The problem there is if you start taking a truly open look around, Java stops looking so cool either.

      Its single greatest feature that might justifiably be called unique is the fact that it has a lot of library support you can buy, and if those things help enough they might tip the balance.

      But in every other way, there's a language that meets or beats Java on almost every level.

      To prevent this from becoming too confrontational, I won't try to name the languages. But Java really isn't the king the pro-Java zealots like to pretend it is; it's just the current Big Kahuna in certain domains, just like C++.

  6. Under Windows... by Ianoo · · Score: 3, Insightful

    I see once again that Eugenia (a supposed pro-Linux pro-BeOS person who doesn't use Windows) has done all her benchmarks [i]under[/i] Windows. I have a feeling that Python would perform a lot better if it was running in a proper POSIX environment (linked against Linux's libraries instead of the Cygwin libs). Probably the C code compiled with GCC would perform a fair bit better too.

    1. Re:Under Windows... by mindriot · · Score: 2, Informative

      The article was actually written by Christopher W. Cowell-Shah. Also, as others noted, except for the I/O benchmark (where gcc was actually faster) the benchmarks couldn't profit much from the OS around it since they were just computationally intensive, but didn't make much use of OS-specific library functions.

    2. Re:Under Windows... by MBCook · · Score: 4, Insightful

      Because as we all know VC++ and the other Microsoft languages are so widly available for Linux/BeOS. I'm sorry but your comment is pure troll. It would be interesting to have things like GCC under Linux on the same computer there too, but you can't compare Microsoft's .NET to anything under Linux, because .NET doesn't run under Linux (I know about Mono, but that isn't MS's runtime).

      --
      Comment forecast: Bits of genius surrounded by a sea of mediocrity.
    3. Re:Under Windows... by Umrick · · Score: 3, Interesting

      Actually, I'm quite comfortable with the performance numbers Python turned in. I use Python quite a bit, and for the things the benchmark was run on, it's the kind of area I'd find looking for bottlenecks, and in turn implement in C or C++.

      Python's huge win is not in speed, but in the ability to express the program in a very concise and easy to understand way.

      The fact that Psyco can provide huge speed ups via a simple import is just icing.

    4. Re:Under Windows... by haystor · · Score: 2, Informative

      There a tons of things where Python is plenty fast. I'm writing something in Python right now. All it has to do is read a line that I type, parse it, work with the db and prompt me for another line. Well over 99% of the time is spent waiting on me to type a line.

      Python waits for input just as fast as all the other languages.

      Development and benchmarking of 1 million human typed lines is left as an exercise for the reader.

      Oh, and my parsing recognizes verbs, nouns, objects and pronouns. All of this is easily optimized to run fast enough in Python. I'm sure it could eventually be made faster in C but I won't even explore that.

      --
      t
    5. Re:Under Windows... by Waffle+Iron · · Score: 3, Insightful
      But these where low-level numeric benchmarks. Except for the I/O one, they wouldn't have changed due to linking against different libraries.

      The review article is /.ed now, but from the test names on the summary table it looks like the tests are indeed mostly numeric. Unfortunately, only a small minority of people make their living writing number crunching code.

      For the vast majority of business and web-based apps, the bulk of operations involves string manipulation. If an app is compute intensive and not I/O or GUI bound, then the bottleneck is usually creating, modifying and destroying strings. Benchmarks on string handling would be more useful to most developers.

      However, doing string manipulation benchmarks isn't so simple. There are at least four approaches to strings, and some languages let you pick any of these:

      -- dangerous and very fast: using static buffers and in-place modifications like old-school C
      -- somewhat safer and may be fast: using semiautomatic memory management with mutable strings, like C++/STL or C with glib's g_string
      -- safer still: using totally automatic memory management with mutable strings, like Ruby or (IIRC) Perl
      -- safest: using totally automatic memory management with immutable strings, like Java or Python

      Of course, for each problem the algorithms would need to be structured differently to get the maximum possible speed in each of the above four methodologies.

      Basically, for string-intensive code, claiming that Java is just as fast as C will always be a false statement if you compare C code written in the first dangerous style vs. Java, which is always written in the fourth and safest style. No matter what technical tricks the VM writers come up with, there is just no way that they'll be able to match C's ability essentially zero-overhead in-place buffer operations over and over in the same spot that stays loaded in the L1 cache. (Actually, you probably could write Java code that operates on raw character arrays, and it might approach the speed of C. But that would probably look even uglier than the C code.)

      In the few cases that I've ported a string-intensive high-level-language algorithm to raw low-level C code with few or no mallocs (not a trivial task), I've gotten at least a 10X speedup on the CPU-bound tasks, and at least 10X less memory usage. (Note that I did those tests largely out of curiosity. For most applications, even a 10X speedup is rarely worth the increased development time, bug vulnerabilities or maintenence issues. My opinion is that if you have to write code like this, you should confine it to a C extension library to a high-level language like Python.)

      I've found that STL can be faster or slower than Java, depending on how smart you are. It's very easy to inadvertently get C++ to thrash around with needless automatic data copying.

      Languages like Perl and Python can be very competetive on string operations if you know how to use their libraries. By using the most powerful operations that work on the largest chunks of data at one time (Python's re.findall(), for example), you take advantage of the fact that the library call is mostly written in C. Bit-banging in a dynamic interpreted language is usually dog slow, as the Python numbers seem to show on the summary chart.

      To sum it up, most people write apps whose performance can't be predicted by a few simple language benchmarks, because the way the app is written can affect the performance more than the language it's written in.

  7. .NET Languages and IL by ClubStew · · Score: 3, Interesting

    Why benchmark the various ".NET languages" (those languages whose compilers target the CLR)? Every compiler targeting the CLR produces Intermediate Languages, or more specifically MSIL. The only differences you'd find is in optimizations performed for each compiler, which usually aren't too much (like VB.NET allocates a local variable for the old "Function = ReturnValue" syntax whether you use it or not).

    Look at the results for C# and J#. They are almost exactly the same, except for the IO which I highly doubt. Compiler optimizations could squeeze a few more ns or ms out of each procedure, but nothing like that. After all, it's the IL from the mscorlib.dll assembly that's doing most the work for both languages in exactly the same way (it's already compiled and won't differ in execution).

    When are people going to get this? I know a lot of people that claim to be ".NET developers" but only know C# and don't realize that the clas libraries can be used by any languages targeting the CLR (and each has their shortcuts).

  8. Would like to see... by CaptainAlbert · · Score: 3, Interesting

    ...some analysis of the code generated by Visual C++ and gcc side by side, particularly for those trig calls. If there's that great a discrepancy between the runtimes, that's a good clue that either one of the compilers is under-optimising (i.e. missing a trick), or the other is over-optimising (i.e. applying some transformation that only approximates what the answer should be). I didn't see any mention of the numerical results obtained being checked against what they ought to be (or even against each other).

    As any games/DSP programmer will tell you, there are a million ways to speed up trig providing that you don't *really* care after 6dps or so.

    OK, maybe I'm just bitter because I was expecting gcc 3.1 to wipe the floor. :)

    --
    These sigs are more interesting tha
  9. Sitting on a Benchmark by Foofoobar · · Score: 2, Interesting

    Well unfortunately, comparing Java to C# on a Windows machine is like comparing a bird and a dolphins ability to swim in water; Several components of C# are integrated right into the operating system so naturally it's going to run faster on a windows machine. Compare C#, C++ and Java on machines where the components aren't integrated and then we will have a FAIR benchmark.

    Oh wait! C# only runs on one operating system. Can you name any other development languages that only run on ONE OS, boys and girls? Neither can I.

    --
    This is my sig. There are many like it but this one is mine.
    1. Re:Sitting on a Benchmark by Mathetes · · Score: 3, Informative

      Oh wait! C# only runs on one operating system. Can you name any other development languages that only run on ONE OS, boys and girls? Neither can I.


      Ximian's Mono has a C# compiler for open OS's:

      http://www.go-mono.com/c-sharp.html
    2. Re:Sitting on a Benchmark by Otter · · Score: 2
      Several components of C# are integrated right into the operating system so naturally it's going to run faster on a windows machine.

      And libc isn't "integrated right into" operating systems? (Richard Stallman would like to have a GNU/word with you, then.) Anyway, who cares? This isn't the Special Olympics. If code runs faster, it runs faster. There are no fairness points.

      Oh wait! C# only runs on one operating system. Can you name any other development languages that only run on ONE OS, boys and girls? Neither can I.

      Besides Mono, C# support is available for MacOS. And there are plenty of single platform languages, by the way. Someone already mentioned AppleScript.

    3. Re:Sitting on a Benchmark by happyfrogcow · · Score: 2, Insightful

      is like comparing a bird and a dolphins ability to swim in water

      Our beloved Penguins can swim quite well under Linux^H^H^H^H^Hwater, thankyou!

    4. Re:Sitting on a Benchmark by ajagci · · Score: 2

      Several components of C# are integrated right into the operating system so naturally it's going to run faster on a windows machine.

      Oh, really? How is going to be "integrated right into the operating system" going to help with integer and floating point microbenchmarks? I'd really like to know.

      And, also, in what sense is the CLR "integrated right into the operating system" that the JVM isn't? Both are a bunch of DLLs running on top of the NT kernel. What's the difference in your mind?

      Oh wait! C# only runs on one operating system. Can you name any other development languages that only run on ONE OS, boys and girls? Neither can I.

      C# runs on many operating systems, as does the CLR. And unlike Java, all of whose implementations are derived and licensed from Sun, C# actually has multiple independent implementations.

      C# is not quite as free and open as, say, ANSI C or Python. You have to decide for yourself whether C# is open enough for you. But C# is clearly far more open and non-proprietary than Java; Java is covered by numerous Sun patents and doesn't even have a free and open specification.

    5. Re:Sitting on a Benchmark by Mandomania · · Score: 2, Interesting

      Microsoft even has an implementation for FreeBSD and OS X.

      Boy, that's gotta be embarrassing :)

      --
      Mando

  10. this is just so bogus by rpeppe · · Score: 4, Insightful

    Benchmark code like this does not represent how these languages are used in practice. Idiomatic Java code tends to be full of dynamic classes and indirection galore. Just testing "arithmetic and trigonometric functions [...] and [...] simple file I/O" is not going to tell you anything about how fast these languages are in the real world.

  11. They should benchmark development time by smartin · · Score: 2, Interesting

    Someone should do a study on the time taken to design, implement and debug a resonably complex chunk of code under C++ and Java. I'm pretty sure that the result would show the huge advanatage of Java over C++.

    --
    The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
    1. Re:They should benchmark development time by ultrabot · · Score: 5, Interesting

      Someone should do a study on the time taken to design, implement and debug a resonably complex chunk of code under C++ and Java. I'm pretty sure that the result would show the huge advanatage of Java over C++.

      The difference b/w Java and C++ would be dwarfed by the difference b/w Java and Python. Java may be 30-40% more productive than C++, but Python is 1000% more productive than Java. And yes, this applies to larger projects. J2EE may come to its own w/ projects that have hundreds of mediocre programmers, but if you have a mid-size team of highly skilled developers creating something new & unique (something like Zope or Chandler), Python will trounce the competition.

      --
      Save your wrists today - switch to Dvorak
    2. Re:They should benchmark development time by ultrabot · · Score: 4, Insightful

      Productive for you now ... but what about 6 months down the road? What if you want to realize your product to the world, how hard is it to extend it?

      The advantages over Java are even increased 6 months down the road. Python code is much more readable and maintainable, hence easier to extend. Dynamically typed object model scales incredibly well.

      I used to think the same about Perl vs Java, until I started looking at frameworks like Cocoon and they're all written in Java.

      Comparing Perl to Java is foolish, Perl is more like Awk than a general purpose programming language, and not meant for large projects at all.

      --
      Save your wrists today - switch to Dvorak
    3. Re:They should benchmark development time by slezakdj · · Score: 2, Insightful
      Point well made, though I could come up with some examples where coding in C++ would be faster than in Java (same for Java over C++). In addition, you should decide on a language given the type of application. All languages have advantages and disadvantages, including execution speed. Some languages are great with debugging, string manip, arithmetic, readability, and maintenance, as we all know. Don't just code in the language you know best. Try to code trig functions in Prolog (please feel free to show an example).

      If the big concern is speed, why not go to the basics and code in assembly (or machine code if you're crazy). Implement some algorithms that will give you a desired precision and that will use the memory that is within the resources. Heck, just use up all your memory resources and create a huge lookup table...

      -I do not move. The world moves around me.-

    4. Re:They should benchmark development time by SlashdotLemming · · Score: 2, Insightful

      Dynamically typed? Bleh.

      I don't know much about Python and I'll give it a go when I get a chance, but it's really hard to take your comments seriously when you call Python a "Silver Bullet" in your sig ;)

    5. Re:They should benchmark development time by rveety · · Score: 2, Insightful

      Comparing Perl to Java is foolish, Perl is more like Awk than a general purpose programming language, and not meant for large projects at all.

      Ummm.. Slashdot is written in Perl, as are many other large projects. I've yet to see anything like Slashdot written in Awk.

    6. Re:They should benchmark development time by ultrabot · · Score: 2, Insightful

      Rubbish. A skilled Java programmer could write a typical piece of code just as quickly as a skilled python programmer - the difference is that becomming a skilled python programmer is easier.

      Do you base this assertion to actual experience, or just a hunch that "it surely must be so"? If both languages are used to solve the same problem, the Python program is much more concise. It's not physically possible to create the Java program as quickly, given the same typing speed. Not to mention the difference in semantic complexity, which determines how fast you can churn out that code (assuming nonzero brain latency).

      I guess people who have never tried dynamic typing can't comprehend how much faster development can be using it.

      --
      Save your wrists today - switch to Dvorak
    7. Re:They should benchmark development time by ultrabot · · Score: 3, Funny

      Ummm.. Slashdot is written in Perl, as are many other large projects. I've yet to see anything like Slashdot written in Awk.

      I heard there was a vote b/w Perl, Awk, Intercal and sed, and Perl won by a narrow margin.

      --
      Save your wrists today - switch to Dvorak
    8. Re:They should benchmark development time by JSkills · · Score: 2, Interesting
      Too echo some of the others ...

      Amazon.com runs completely on HTML::Mason, which is 100% Perl. All development for the site is done in Perl. Would that qualify as a "large project"?

      Why is it that people always make the same kinds of blanket statements about Perl? "It's not for big projects". "It's not for ecommerce systems". Why is not for large projects?

    9. Re:They should benchmark development time by Empyrean9 · · Score: 2, Insightful

      "Dynamically typed object model scales incredibly well."

      Sorry, no it doesn't. You can't overload functions. You can't use true polymorphism. You can't enforce inheritance. You can't code to an interface, or abstract class. You can't just look at a function definition and know what type of parameters it contains. You can't detect type-based errors until runtime. These are all the things that will slow you down in six months, and beyond. I've been there, and thats why I will never go back to a dynamically typed language for anything over 2,000 lines.

  12. heres the link to the code by manifest37 · · Score: 2, Informative
  13. What about coder's performance? by G4from128k · · Score: 3, Interesting

    Given the ever accelerating clockspeed of processors, is the raw performance of langauges that big an issue? Except for CPU-intensive programs (3-D games, high-end video/audio editing), current CPUs offer more than enough horsepower to handle any application. (Even 5-year old CPUs handle almost every task with adequate speed). Thus, code performance is not a big issue for most people.

    On the other hand, the time and cost required by the coder is a bigger issue (unless you outsource to India). I would assume that some languages are just easier to design for, easier to write in, and easier to debug. Which of these langauges offers the fastest time to "bug-free" completion for applications of various sizes?

    --
    Two wrongs don't make a right, but three lefts do.
    1. Re:What about coder's performance? by nuggz · · Score: 2, Insightful

      I agree, time to market is key.

      I like python, it is easy to write, and keep it somewhat clean.

    2. Re:What about coder's performance? by Dalroth · · Score: 4, Insightful

      Raw performance will ALWAYS be an issue. If you can handle 100,000 hits per day on the same hardware that I can handle 1,000,000 (and these are not made up numbers, we see this kind of discrepency in web applications all the time), then I clearly will be able to do MORE business than you and do it cheaper. That gives me a competitive advantage from now till the end of time. If you throw more hardware at the problem, well, so can I and I'll still be ahead of you.

      Performance realities do not go away, no matter how much we may wish they would. Now, does that mean you're going to go write major portions of your web application in assembly to speed it up? No, probably not. But your database vendor may very well use some tricks like that to speed up the key parts of their database. You sink or swim by your database, so don't say it doesn't matter because it absolutely does.

      Anyway, in my day-to-day operations, I can think of quite a few things that get compiled directly to executable code even though they don't have to be. Why would you do this if performance wasn't an issue and we could just throw more hardware at it?

      1. Regular expressions in the .NET environment are compiled down to executable code, then executed.

      2. XSL transformations in the .NET environment are compiled to a form of executable code (I don't think it's actual .NET byte code, but it may be) and then executed.

      3. The XmlSerializer classes creates a special compiled executable specifically created to serialize objects into XML (byte code!!).

      And the list just goes on and all of this eventually ends up getting JITed as well. My pages are 100% XML based, go through many transformation steps to get to where they need to be, and on average render in about 70-100ms (depending upon the amount of database calls I need to make and the size of the data). This all happens without spiking our CPU utilization to extreme levels. There is *NO WAY* I could've done this on our hardware if nobody cared about performance.

      As always, a good design is the most important factor. But a good design that performs well will always be superior to one that doesn't.

      Bryan

    3. Re:What about coder's performance? by FiskeBoller · · Score: 2, Insightful

      ... and Smalltalk zealots not too far behind.

      I did my own productivity benchmarks between C++ and Smalltalk in 1996. I consider myself very adept at both languages. At the time I was coding C++ CORBA internals that had to function across 10 platforms (gawd, what a pain). I was also involved in a Smalltalk ORB project.

      My productivy benchmark was completing foundation frameworks for a financial trading package. The time required to complete equal functionality in C++ was 10x the amount it took in Smalltalk. I found it agreed with similar claims in language productivity.

      It's important to consider the context in which the program will operate. This drives the requirements a solution will need to fulfill, and in turn, may influence the choice of environment, frameworks, libraries, and language.

      There are cases where the speed of delivering accurate, new functionality is paramount. In these cases, I wouldn't want to be using C++.

  14. Speed or accuracy? by derek_farn · · Score: 5, Interesting

    The Java performance is best explained by an article by Prof Kahan: "How JAVA's Floating-Point Hurts Everyone Everywhere" http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf also see "Marketing vs. Mathematics" http://www.cs.berkeley.edu/~wkahan/MktgMath.pdf I suspect the relatively poor floating-point performance of gcc is also caused by the desire to acheive accurate results.

  15. Where is Fortran? by Aardpig · · Score: 2, Insightful

    It's a pity that the present-day language of choice for high-performance computing, Fortran 90/95/HPF, was not covered in this study. There has been anecdotal evidence that C++ has approached Fortran, performance-wise, in recent years, but I've yet to see a proper comparison of the two languages.

    --
    Tubal-Cain smokes the white owl.
  16. Alternative comparison, compiler shootout by SiW · · Score: 5, Informative

    Don't forget about the Win32 Compiler Shootout

  17. About the Python performance by ultrabot · · Score: 5, Insightful

    Note that Python is pretty easy to extend in C/C++, so that speed critical parts can be rewritten in C if the performance becomes an issue. Writing the whole program in C or C++ is a premature optimization.

    --
    Save your wrists today - switch to Dvorak
    1. Re:About the Python performance by James+Thompson · · Score: 2, Informative

      You could also use pyrex and save yourself the troubles of dealing with the Python/C API.

  18. What about development ease... by Slick_Snake · · Score: 2, Insightful
    There is more to programming languages than pure speed. I have written programs in a number of languages and find it irritating when people start dissing languages because they are slower at run time. I have on numbers occations written applications for people in "slow" languages because it was easy to write, easy to maintain, and was not a time critical application. In most cases the speed limiting factor is the human sitting in front of the screen.

    IMO a program should use whatever tools are available and appropreate for the job, and not just worry about what is faster.

  19. Read the OSNews thread by be-fan · · Score: 5, Insightful

    There were a number of problems with this benchmark, which are addressed in the OSNews thread about the article.

    Namely:

    - They only test a highly specific case of small numeric loops that is pretty much the best-case scenario for a JIT compiler.

    - They don't test anything higher level, like method calls, object allocation, etc.

    Concluding "oh, Java is as fast as C++" from these benchmarks would be unwise. You could conclude that Java is as fast as C++ for short numeric loops, of course, but that would be a different bag of cats entirely.

    --
    A deep unwavering belief is a sure sign you're missing something...
  20. Quoting the results section here... by Jugalator · · Score: 5, Informative

    Site was showing signs of Slashdotting, so I'll quote one of the more important sections...

    Results

    Here are the benchmark results presented in both table and graph form. The Python and Python/Psyco results are excluded from the graph since the large numbers throw off the graph's scale and render the other results illegible. All scores are given in seconds; lower is better.

    int long double trig I/O TOTAL

    Visual C++ 9.6 18.8 6.4 3.5 10.5 48.8
    Visual C# 9.7 23.9 17.7 4.1 9.9 65.3
    gcc C 9.8 28.8 9.5 14.9 10.0 73.0
    Visual Basic 9.8 23.7 17.7 4.1 30.7 85.9
    Visual J# 9.6 23.9 17.5 4.2 35.1 90.4
    Java 1.3.1 14.5 29.6 19.0 22.1 12.3 97.6
    Java 1.4.2 9.3 20.2 6.5 57.1 10.1 103.1
    Python/Psyco 29.7 615.4 100.4 13.1 10.5 769.1
    Python 322.4 891.9 405.7 47.1 11.9 1679.0

    --
    Beware: In C++, your friends can see your privates!
  21. Re:Wow by thoolihan · · Score: 3, Insightful

    Keep in mind too that these benchmarks were all run on windows. I think gcc plays a lot nicer with glibc compared to the windows native libraries. Also, as pointed out, it's about being portable, not the most optimized compiler.

    -t

    --
    http://unmoldable.com W:"No one of consequence" I:"I must know" W:"Get used to disappointment"
  22. Re:Wow by Daniel+Boisvert · · Score: 2, Informative

    I found it interesting to note in the benchmark design that the Visual C++ compile used the "omit frame pointer" option, while gcc did not. It seems to be the consensus over at the Gentoo Forums that this flag makes a fairly noticable difference (if negatively impacting debug options), and I'd like to see the C piece re-run using this option. It's tough enough to compare apples to apples in tests such as these, but at least try to use the same compile flags where available..

    Dan

  23. IBM Java by PourYourselfSomeTea · · Score: 3, Interesting

    Using the IBM Java VM, I've been able to achieve consistently cutting my runtimes in half over the Sun VM. Anyone currently using the Sun VM for production work should test the IBM one and consider the switch.

    My application that I benchmarked is data and network and memory intensive, although not math intensive, so that's what I can speak for. We consistently use 2 GB of main memory and pump a total of 2.5 TB (yes, TB) of data (doing a whole buch of AI style work inside the app itself) through the application over it's life cycle, and we cut our total runtime from 6 days to 2.8 days by switching to the IBM VM.

  24. Not testing languages by xtheunknown · · Score: 3, Insightful

    You are not testing the languages, you are testing the compilers. If you test a language with a crummy compiler (gcc sucks compared to commercial optimized C++ compilers) you will think the language is slow, when in fact, the compiler just sucks. The only valid comparisons that can be made are same language, different compilers.

    --

    They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.
  25. wrong questions by ajagci · · Score: 4, Insightful
    The Java JIT has been comparable to C in performance for many years on certain microbenchmarks. But Java remains a "slow language". Why?
    • The design of the Java language and the Java libraries means that enormous numbers of calls are made to the memory allocator in idiomatic Java.
    • The Java language has several serious limitations, such as the lack of true multidimensional arrays and the lack of value classes.

    So, yes, you can construct programs, even some useful compute intensive programs, that perform as well or better on Java than they do in C. But that still doesn't make Java suitable for high-performance computing or building efficient software.

    Benchmarks like the one published by OSnews don't test for these limitations. Microbenchmarks like those are still useful: if a language doesn't do well on them, that tells you that it is unsuitable for certain work; for example, based on those microbenchmarks alone, Python is unlikely to be a good language for Fortran-style numerical computing. But those kinds of microbenchmarks are so limited that they give you no guarantees that an implementation is going to be suitable for any real-world programming even if the implementation performs well on all the microbenchmarks.

    I suggest you go through the following exercise: write a complex number class, then write an FFT using that complex number class, "void fft(Complex array[])", and then benchmark the resulting code. C, C++, and C# all will perform reasonably well. In Java, on the other hand, you will have to perform memory allocations for every complex number you generate during the computation.
  26. Less simple benchmarks by DuSTman31 · · Score: 4, Insightful

    The optimisers in sun's Java VM work on run-time profiling - they identify the most run sections of code and use the more elaborate optimisation steps on these segments alone.

    Benchmarks that consist of one small loop will do very well under this scheme, as the critical loop will get all of the optimisation effort, but I suspect that in programs where the CPU time is more distributed over many code sections, this scheme will perform less well.

    C doesn't have the benefit of this run-time profiling to aid in optimising critical sections, but it can more afford to apply its optimisations across the entire codebase.

    I'd be interested to see results of a benchmark of code where CPU time is more distributed..

  27. Poor benchmarks by Anonymous Coward · · Score: 2, Insightful

    Come on guys, carefully choosing that simple benchmarks I can easily prove any language's faster than GCC.

  28. Re:Wow by be-fan · · Score: 5, Interesting

    According to these benchmarks it doesn't.

    The short of it is that GCC 3.2.1 is highly competitive with ICC 7.0, except for two cases:

    FP-intensive code on the Pentium 4
    Code that allows Intel C++ to auto-generate SSE vector code for it

    --
    A deep unwavering belief is a sure sign you're missing something...
  29. Re:Wow by jrexilius · · Score: 2, Informative

    I would say yes, If you are coding just for WinTel platforms I would use MS tools and/or the Intel compiler. If you are coding only for SPARC/solaris, use their compiler.

    GCC, like apache, is meant to be correct and portable first, fast second. Despite this, I wouldn't say thats its performance sucks, I would say that it is the fastest cross-platform option available. (as compared to Java the only other cross platform non-interpreted language in the test group).

  30. It all depends on what you are doing by finkployd · · Score: 2, Insightful

    I like java for some things, and the performance has even improved a bit lately. However if I am doing ANYTHING that has to scale and perform well under heavy load that uses cryptographic functions (especially public key encipherment), there is no way I can even seriously consider Java.

    Someone (meaning anyone other than me) should do a benchmark of THAT, I'm sure it would be quite telling.

    Finkployd

  31. Python Longs are arbitrary precision! by PommeFritz · · Score: 4, Informative

    The Python 'long' type is not a machine type such as a 32 or 64 or perhaps even 128 bit integer/long.
    It is an arbitrary precision decimal type! That's why Python's scores on the Long test are so much higher (slower) than the other languages.
    I wonder what Java scores when the benchmark is reimplemented using BigDecimal instead of the 'long' machine type.
    Python uses a highly efficient Karatsuba multiplication algorithm for its longs (although that only starts to kick in with very big numbers).

    1. Re:Python Longs are arbitrary precision! by LnxAddct · · Score: 2, Informative

      Thank you! I was just about to point this out. Python will handle integers of any length which can really come in handy. None of that puny 64 bit or 128 bit stuff. You can easily work with 10,000 bit integers and higher, I do all the time. There are a few other features of python like this, so its not really fair to compare unless you are using similar functions in the other languages. I for one find this arbitrary precision indespensable.[For those who don't use python or don't code, this simply means that you can pass python any number no matter how big (limited only by your hardware) and it will handle it with no complaints and do whatever you want with it]
      Regards,
      Steve

  32. Re:Wow by LinuxInDallas · · Score: 4, Interesting

    There was an interesting article in Dr Dobb's a few months back. They did a performace (C++) comparison of 6 or so compilers, gcc included. The end result was that performace wise (execution AND code size) gcc came in last place in all their testing. However, gcc did win when it came to conformance to the C++ standard as it was the only compiler that supported all the language features.

  33. performance depends on the application by lambent · · Score: 2, Insightful

    It's well known that benchmarks aren't the be all and end all. They're often just statistics geared towards a ultra-specific application (remember all those /. stories about benchmark cheating vendors?)

    I've seen examples of gcc in a cygwin shell kicking visual-c++ ass at load up times of huge image data on a wintel box. I've also seen java (jdk 1.3) annihilate native c code on console apps calculating complex mathematical formulas on a linux box. This goes for both AMD and Intel chips.

    Moral of the story? These languages are all suited to specific uses. Analyze your tasks, your platforms, and your compilers. Learn how to use optimizations properly. Evaluate your need for portability. Do a few tests for performance in different languages and compilers to see which one actually is fastest for your current application.

    There is no single "fastest" language.

  34. Re:Speed? No. Stability. Yes by Isochrome · · Score: 4, Insightful

    OK, Speed does matter a lot.

    But what about type safety? Java has no generic typed containers, like the STL. This means you tend to find errors at runtime instead of at compile time.

    I need to know that my code is as safe as possible. I don't want a user to find a bug because my hand tests didn't get 100% code coverage every time.

    And how about predictable performance. I would much rather know that this function will tak 200ms all of the time instead of 100ms most of the time a 10 s due to garbage collection occasionally.

  35. Comparison of ikewillis' Linux results to Windows by Eponymous+Cowboy · · Score: 2, Interesting

    Conveniently I have the same system configuration as ikewillis (dual 2.0 GHz Athlon MP), but am running Windows XP instead of Linux. I also have Intel C++ 8.0, which he used on Linux to generate his results.

    So I ran the same tests that he ran under Linux under Windows. Here are my results from Intel C++ 8.0, with Profile Guided Optimization turned off (comparing to his with PGO on):

    Integer performance: 6265 ms (he got 6340 ms)
    Floating point perfomance: 4547 ms (he got 5540 ms)
    64-bit Integer preformance: 13547 ms (he got 27140 ms)
    Trig performance: 2250 ms (he got 2430 ms)
    I/O performance: 7360 ms (he got 1190 ms)

    Running the same tests under Windows with PGO turned on, the numbers did not change except on the least-significant digits, so I won't bother to list those too. Before running the tests, I set the program to run at high priority on one processor to avoid unnecessary interference from other running applications, or unnecessary processor-jumping--although when I tried it without, there wasn't much of a difference (< 1%).

    Conclusions? First, it seems the 64-bit integer performance problem is something that exists only for Intel C++ 8.0 on Linux, not Windows. Second, it seems stdlib I/O performance is significantly higher under Linux than under Windows for this benchmark.

    --
    It's hard for thee to kick against the pricks.
  36. Re:java vs C by jrexilius · · Score: 2, Insightful

    Yeah, with the increase in hardware price/performance the performance consideration is becoming less and less of a consideration in _most_ applications. There are still environments where efficiency is of paramount concern (the combination of great speed and low resource drag). Examples I work with are real-time financial trading applications, network back-bone servers (routers firewalls, intelligent switches, etc.), mobile and embedded devices, server daemons, and network applications (packet sniffers, etc.).

    For general business processing applications and most web applications, efficiency is less of a concern and cost/time-to-market/maintainability/security are bigger.

    I like these benchmarks but would like to see ones that also benchmark the other characteristics of languages (such as lines of code to do a common task, number of tests that need to be performed to validate common functions, memory space, etc. etc.)

  37. Language performance arguments miss the point by tizzyD · · Score: 5, Insightful
    Consider what was done years ago with assembly. The performance was incredible, and the amount of superfluous garbage in the code was minimal. Hey, if you wrote the assembly, why would you spend time putting it in?

    Then, with more and more languages, especially ones with VMs, you get further and further away from the hardware. The end result: you lose performance. It does more and more for you, but at the expense of real optimizations, the kind that only you can do.

    Now the zealots will come out and say, "Language X is better than language Y, see!" To me this argument is boring. I tend to use the appropriate tool for the job. So:

    • Python for scripts, prototypes, proofs of concept, or components where performance generally is not an issue.
    • For desktop apps, Visual Basic (yep, most IT apps are in VB). There is no justifiable reason for an IT department group to write a sales force reporting system in C++! If you want C++, go get a job at a software company. Stop wasting money and time making yourself feel like a hotshot. [I'd consider Kylix here if it was based on Basic. Why? Because honestly, Pascal is just about dead, and Basic is the king of the simple app. Let's just live with it and move on. I do want a cross-platform VB . . . ]
    • For web apps, well, I stick around PHP/ASP.NET. Why? Portability! And moreover, the sticking point in a web-based app is not the UI layer; it's usually the underlying data extraction and formatting. Don't waste your time with lower level languages there. IMHO it's just not worth it. JSP and Java stuff, yuck! Too much time for too little bang.
    • Java/C# (also consider mono/LISP for most production apps. Why? Portability! I want no vendor holding me by the balls. I want platform independence on the back end, and these are the few ways to achieve it. I'd include Haskell/OCAML here when appropriate. Perl? I'm loathe to use Perl as production, considering most Perl code cannot be understood 2 weeks after it's written. I'd rather take the hit in performance and be able to pass the code to someone else later.
    • C++/C for components--just components--where performance is at an absolute premium or there exists some critical library that only has this kind of interface. But this step has to be justified by the team, with considerable explanation why a different architecture could not suffice. Otherwise, the team could waste time checking for dangling pointers when instead it could be doing other things, like finishing up other projects.
    • Assembly? Only when there is not a C complier around. Embedded stuff. Nowadays, you just do not have the time to play.

    Yes, my teams use many languages, but they also put their effort to where they get the biggest bang for the buck. And in any business approach, that's the key goal. You don't see carpenters use saws to hammer in nails or drive screws. Wise up!

    --
    ...tizzyd
    1. Re:Language performance arguments miss the point by BrownTiger · · Score: 2, Insightful

      Use whatever forks for you. There aren't any golden rules. If someone have large C++ libraries he/she can easily beat java/vb in development/deployment. We use VC++, and outperform VB coders by 20 - 30%. ( Plus code a LOT more stable ) Brian

    2. Re:Language performance arguments miss the point by Fr33z0r · · Score: 2, Insightful
      Then, with more and more languages, especially ones with VMs, you get further and further away from the hardware. The end result: you lose performance. It does more and more for you, but at the expense of real optimizations, the kind that only you can do.

      I don't really agree with this, look at it from a high-level API stance for starters, I'd much rather write some DirectX or OpenGL than write the assembly code necessary to cover my bases with all the 3d hardware out there - with no guarantee my 3d code would work on future hardware. The good old days of calling a BIOS interrupt to put your display into 13h and writing direct to the video memory at (320*y)+x are dead and buried, unfortunately (I'll admit those were fun times :D)

      The above is a somewhat extreme example of how low-level code can be not only inefficient (unless you're *seriously* hard-core) but utterly pointless due to the inordinate amount of time it would take to write said code. It's an extreme example, but it translates almost directly to today's processors - being the complicated beasts they are. You look at things a good optimising compiler will just do for you completely transparently, like branch prediction, mmx, 3dnow, and a host of others (recently, and notably, hyperthreading for instance)...

      If you think you can do a better job of writing low-level code than these compilers can do of optimising your high-level, you're either still living in the early 90s, or you're one hell of a programmer.
    3. Re:Language performance arguments miss the point by Anonymous Coward · · Score: 2, Funny

      Of course it is! It runs on the Windows machine in my office and the one down the hall.

  38. Re:Which Java VMs were used? by FiskeBoller · · Score: 2, Interesting

    I would like to see benchmarks between Java vendors on the same platform for 1.4.x. Specifically, I'd like to see Sun JVM, IBM J9, and BEA JRocket. The question is how do other commercial JVMs really stack up against the Sun standard.

    I would also like to see benchmarks of the same JVM across different operating systems on the same processor, namely Windows, Linux, BSD, and (if it matters) Solaris x86. The question is how do other JVMs stack up against the Windows 'standard'.

    It would also be nice to see a 'leveling' benchmark across different processors, specifically comparing a suite of Java benchmarks on WinTel and MacOS.

  39. trig calls in gcc by ajagci · · Score: 5, Informative

    The Pentium trig instructions are not IEEE compliant (they don't return the correct values for large magnitude arguments). gcc errs on the side of caution and generates slow, software-based wrappers that correct for the limitations of the Pentium instructions by default. Other compilers (e.g., Intel and probably Microsoft) just generate the in-line instructions with no correction. When you look at the claimed superiority of other compilers over gcc, it is usually such tradeoffs that make gcc appear slower.

    You can enable inline trig functions in gcc as well, either with a command line flag, or an include file, or by using "asm" statements on a case-by-case basis. Check the documentation. With those enabled, gcc keeps up well with other compilers on trig functions.

    1. Re:trig calls in gcc by greg_barton · · Score: 3, Insightful

      On top of this, the Java/Linux VM from Sun (and most other Java/Linux VMs) is compiled using gcc. I don't know for sure, but I wouldn't be suprised if Sun erred on the side of correctness and standards compliance, so I'll bet they compiled the VM without inlining any trig function calls.

  40. Totaly missing parts by musicmaker · · Score: 2, Insightful

    I don't know about anyone else, but most programs in the real application world do alot of string manipulation, and I have seen some pretty shocking results of string manipulation benchmarks showing Java the worst with the C++ class second, and Python actualy leading the pack. It would be usefull to also see the overhead calcs for object management too. Java is so memory heavy we have problems with machines that have 4 Gig of RAM configured.

    It's pretty stupid to run benchmarks for a language in a non native environment for the python marks.

    Yet again OS News publishes a completely meaningless story.

    --
    Everyone is living in a personal delusion, just some are more delusional than others.
  41. Windows a good choice for this test by nberardi · · Score: 3, Insightful

    Windows was a good choice for this test, because many of the development languages that were used in this test aren't really mature enough in *nix. (i.e. .Net languages and arguably Java) A better test would be doing both tests on both OS's, because GCC is really more optimized twords Linux, while VC++ is more optimized twords Windows. I would have rather seen VC++ vs. Borderland C++, because that is a more real world business example.

  42. These kind of benchmarks are so 1970s by Junks+Jerzey · · Score: 3, Insightful

    It is amusing that the obsession with raw speed never goes away, even though computers have gotten thousands of times faster since the the days of the original wisdom about how one shouldn't be obsessed with speed. Programmers put down Visual Basic as slow when it was an interpreted language running on a 66MHz 486. It was still put down as slow when it shared the same machine code generating back-end as Visual C++ running on a 3GHz Pentium 4. And still some people--usually people with little commercial experience--continue to insist that speed is everything.

    Here's a bombshell: if you have a nice language, and that language doesn't have any hugely glaring drawbacks (such as simple benchmarks filling up hundreds of megabytes of memory), then don't worry about speed. From past experience, I've found it's usually easy to start with what someone considers to be a fast C or C++ program. Then I write a naive version in Python or another language I like. And guess what? My version will be 100x slower. Sometimes this is irrelevant. 100x slower than a couple of microseconds doesn't matter. Other times it does matter. But it usually isn't important to be anywhere near as fast as C, just to speed up the simpler, cleaner Python version by 2-20x. This can usually be done by fiddling around a bit, using a little finesse, trying different approaches. It's all very easy to do, and one of the great secrets is that high-level optimization is a lot of fun and more rewarding than assembly level optimization, because the rewards are so much greater.

    This is mostly undiscovered territory, but I found one interesting link.

    Note that I'm not talking about diddly high-level tasks in language like Python, but even things like image processing. It doesn't matter. Sticking to C and C++ for performance reasons, even though you know there are better languages out there, is a backward way of thinking.

    1. Re:These kind of benchmarks are so 1970s by EvilTwinSkippy · · Score: 2, Insightful
      I'm a TCL nazi. Back when I started (hint, the Pentium Bug was news) we would have to compile critical sections of our programs in C to get any kind of acceptable performance.

      Today, everything is in script because it's not worth the bother anymore. In 1998 I had to write my own affine transformation code in C to get a GUI to work at anywhere near real-time. Today I can run a planetarium simulator (read LOTS of calculations) at an acceptable speed in just script.

      --
      "Learning is not compulsory... neither is survival."
      --Dr.W.Edwards Deming
    2. Re:These kind of benchmarks are so 1970s by pclminion · · Score: 2, Interesting
      Your comparison is ridiculous. Computer speeds increase exponentially. Cars could easily do 100 MPH in the 1960s, and haven't significantly "improved" since then.

      If cars followed Moore's law we'd all be driving at the speed of light about now. And guess what -- that's completely unnecessary.

      No, I wouldn't want a 20 HP engine in my car. But I don't feel the need for a 1.6e9 HP engine, either.

  43. Python numbers by Error27 · · Score: 2, Interesting
    In some ways, this kind of math is a funny thing to benchmark. Adding and multiplication are just tiny assembly language instructions that are the same no matter what human readable programming language the test originally used. Any differences in the run time is going to be caused by other parts of the language.

    Python did pretty badly in the tests. The reason is that in Python it takes a long time to translate a variable name into a memory address (It happens at runtime instead of compile time).

    The benchmark code has stuff that basically looks like this:

    while foo < maxInt:
    i += 1


    Adding 1 to i takes no time at all but looking up i take a little time. In C this is going to be a lot faster.

    Python did really bad when "i" from the example above was a long compared to when it was a long in C. That's because Python has big number support but in C a long is limited to just 4 bytes.

    Python did OK in the trig section because the trig functions are implemented in C. It still suffers because it takes a long time to look up variables though.

    In real life, variable look up time is sometimes a factor. However, for programs that I've written getting data from the network, or database was the bottleneck.

  44. G++? by phorm · · Score: 2, Insightful

    I know it ties into the GCC libs, but does G++ behave any better/worse than GCC. Comparing VC++ (a C++ compiler) and GCC (a C compiler) is a bit skewed. Also, how about a comparison of GCC in windows VS linux (comparable machines), just to see if the OS has any bearing on things?

  45. Tester does not understand Java by dnoyeb · · Score: 2, Informative

    Third, Java 1.4.2 performed as well as or better than the fully compiled gcc C benchmark, after discounting the odd trigonometry performance. I found this to be the most surprising result of these tests, since it only seems logical that running bytecode within a JVM would introduce some sort of performance penalty relative to native machine code. But for reasons unclear to me, this seems not to be true for these tests.

    I dont know why the reasons are not clear to him. Perhaps its because he still thinks the JVM is "running bytecode" and does not understand what JITs did or what HotSpot compilers do. Byte code is only run the first few passes, after which its optimized into native code. Native being whatever the compiler of the c program used to compile the JVM could do. This is fundamental. Which explains his results, and points to a poor HotSpot implementation where trig functions are concerned.

  46. Why no ActivePerl? by frostman · · Score: 2, Interesting

    Why didn't they include ActivePerl?

    In the article it rather sounds like they just assumed Python performance would be an indicator of performance for interpreted languages generally, but is there anything to back this up?

    --

    This Like That - fun with words!

  47. Problem: Java not portable by Srin+Tuar · · Score: 2, Interesting


    I actually use C++ for portability, not speed or generic programming (which are nice to have).

    If you avoid platform, compiler, and processor specific features, C++ is even more portable than Java. Java on the other hand tends to drag all platforms down to the least common denominator, then requires the use of contorted logic and platform extensions just to attain acceptable performance.

    People seem to have forgotten the original intention of C: portable code.

  48. Re:Java as fast as c++????? by radish · · Score: 2, Insightful

    So it couldn't possibly be a problem with the app? It has to be the language it's written in? By that logic, C/C++ must suck really badly, because we all know how unreliable Windows 95 was. Puuuurlease.

    --

    ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

  49. Slashdotted by ReadParse · · Score: 4, Funny

    They should have written their site in one of the higher-performing languages.

    RP

  50. Performance not important? Umm , not quite... by Viol8 · · Score: 3, Interesting

    I was a bit surprised by this quote in the article:

    "Even if C did still enjoy its traditional performance advantage, there are very few cases (I'm hard pressed to come up with a single example from my work) where performance should be the sole criterion when picking a programming language. I"

    I can only assume from this that he has never done or known anyone who has done any realtime programming. If you're going to write something
    like a car engine management system performance is the ONLY critiria, hence a lot of these sorts of systems are still hand coded in assembler , never
    mind C.

  51. Java benchmarks are flawed. by _LORAX_ · · Score: 2, Insightful

    1) JIT optimizations don't always kick in until a function has been run several times. Since the bechmarks only run once, they are crippled on java.

    2) Java's IO function work on UTF-8 or other system dependant character set. So in essence java is doing twice the ammount of work during the IO benchmark.

    I'm sure other people will comment as well, but overall these numbers are not that suprising for code that was just copy and pasted from c code. Why do people expect that ANY language will perform well using another languages code.

  52. Cost of Hardware vs. Cost of wetware by G4from128k · · Score: 4, Insightful

    Raw performance will ALWAYS be an issue. If you can handle 100,000 hits per day on the same hardware that I can handle 1,000,000 (and these are not made up numbers, we see this kind of discrepency in web applications all the time), then I clearly will be able to do MORE business than you and do it cheaper.

    You raise excellent points. For many enterprise and server applications, performance is an issue. But I never said one should care nothing abut performance, only that in many applications the cost of the coder also impacts financial results.

    For the price of one software engineer for a year (call it 50k to 100k burdened labor rate), I can buy between 20 to 100 new PCs (at $1000 to $3000 each). If the programmer is more expensive or the machines are less expensive, then the issue is even more in favor of worring about coder performance.

    The trade-off between the hardware cost of the code and the wetware cost is not obvious in every case. A small firm that can double its server capacity for less than the price of a coder. or the creators of an infrequently-used application may not need high performance. On the other hand, a large software seller that sells core performance apps might worry more about speed. My only point is that ignoring the cost of the coder is wrong.

    These different languages create a choice of whether to throw more hardware at a problem or throw more coders at the problem.

    --
    Two wrongs don't make a right, but three lefts do.
  53. Portable.net vs MONO by SlightOverdose · · Score: 2, Interesting

    I ran four tests using Portable.net and mono. For lazyness reasons I only ran Int and Trig benchmarks. All tests were performed on a 2.4ghz p4.

    First, I compiled Benchmark.cs using cscc (portable.net) and mcs (mono).

    I then ran each binary with mono and ilrun (portable.net). Results are interesting.

    Portable.net compiler: cscc -O3 Benchmark.cs

    $ ilrun Benchmark.portable.exe
    Int arithmetic elapsed time: 12996 ms
    Trig elapsed time: 28700 ms

    $ mono Benchmark.portable.exe
    Int arithmetic elapsed time: 16235 ms
    Trig elapsed time: 4534 ms

    Mono Compiler: mcs Benchmark.cs

    $ ilrun Benchmark.exe
    Int arithmetic elapsed time: 13784ms
    Trig elapsed time: 27939 ms

    $ mono Benchmark.exe
    Int arithmetic elapsed time: 15994 ms
    Trig elapsed time: 4596 ms

    As you can see, Portable.net has slightly faster Int math, but crumbles under the trig functions. There is no significant difference between the compilers.

    the Portable.net runtime had a serious bug where the time calculated was an order of magnitute out. I used the unix time command to get a more accurate result.

    It would be interesting to do this comparison using Microsoft.NET as well. I would assume Microsoft.net would absolutely rape these results.

    n.b. Please note this was not a comprehensive benchmark. I disabled some of the tests because I didn't feel like waiting (So sue me), while X, xmms, xchat, etc were running.

  54. Ongoing, open source "language shootout" by DavidNWelton · · Score: 2, Informative

    We weren't quite ready to release it, but we've been working on a language performance comparison test of our own. It is available at:

    http://scutigena.sourceforge.net/

    It's designed as a framework that ought to run cross-platform, so you can run it yourself. We haven't added it yet, but I think we really want to divide the tests into two categories. "Get it done" - and each language implements it the best way for that language, and "Basic features comparison" - where each language has to show off features like lists, hash tables, how fast function calls are, and so forth.

    It's an ongoing project, so new participants are welcome! I would appreciate it if comments went to the appropriate SF mailing lists instead of here, so that I can better keep track of them.

  55. Not a fair test - Frame Pointers by Compenguin · · Score: 3, Insightful

    His benchmark isn't fair, he's omitting the fame pointer on VC++ but not gcc. How is that fair?

  56. Consider the logic... by tizzyD · · Score: 3, Insightful
    But that's what you know so well. I bet if I took a team of VB programmers who knew VB as well as you know VC++, and then challenged them to produce a series of business oriented apps, in most cases you'd lose. How many VC++ programmers does it take to create a business app? 2 * VB Programmers usually -OR- how long does it take to create and debug a business app in VC++? 2 * VB time. ;-) JK!

    Guido van Rossum noted in an interview the following statistic, and I think it bears considerably on appropriateness:

    This [ed: these stats] is all very informal, but I heard someone say a good programmer can reasonably maintain about 20,000 lines of code. Whether that is 20,000 lines of assembler, C, or some high-level language doesn't matter. It's still 20,000 lines. If your language requires fewer lines to express the same ideas, you can spend more time on stuff that otherwise would go beyond those 20,000 lines.

    A 20,000-line Python program would probably be a 100,000-line Java or C++ program. It might be a 200,000-line C program, because C offers you even less structure. Looking for a bug or making a systematic change is much more work in a 100,000-line program than in a 20,000-line program. For smaller scales, it works in the same way. A 500-line program feels much different than a 10,000-line program

    So then, unless you quantify the types of apps you build, the team you use, and the results that are expected, my experience has shown me that most of the time, for business apps, it's overkill. Now, if you're in a dev team at a software company, well then, I could consider the other side.

    --
    ...tizzyd
  57. Coming in 1.5, but you can do this now by SuperKendall · · Score: 4, Insightful

    That's a feature built into Java 1.5, but you can get a test reference implementation which is about 96% of the features now to try it out. It has a really clean syntax and provides the benefit you seek.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  58. Reminds me of... by vasqzr · · Score: 2, Insightful


    Reminds me of my 6th grade 'science fair' project.

    I took a couple different compilers, languages, did some loops and math and such, timed them all.

    "Which computer language is the fastest"

    About half way through the project I realized how big of a waste of time it was.

    What kinds of things should you be testing?

    Speeds of function calls???

    Implement various sorting algorithims?

    Audio/Video compression/decompression?

    When it comes down to it, it's all the same math, and any good compiler is going to come close to making the same darn code.

    By now, we all know that you use one language for one thing, and another language for another. For various reasons.

    A hammer is your only tool if all your problems are nails, isn't the cliche?

  59. Tried this with gcj 3.2, here are the results by BreadMan · · Score: 3, Informative
    Compiled with gcj Benchmark.java --main=Benchmark -o benchmark, compiled other program with the same optimization level.

    Comparison against gcc, gcj and Java 1.4.1 on the same host:
    .......... gcc........gcj.......java
    int.......28,700.....35 ,386....22,953
    double....30,000.....73,504....27, 529
    long......61,520.....61,729....68,914
    trig.. ....11,020....112,497...176,354
    io.........1,930. ....16,533....11,297
    I was somwhat surprised on the difference in the trig tests, as both appear to use libm. Not surprised that the IO was slower, the Java IO classes are nifty but do add quite a bit of overhead compared fputs/fgets.

    (Sorry about the formatting, it was the best I could do)
  60. I just sped the Python version by 7x and 1.5x by b0rken · · Score: 5, Interesting
    IMO this benchmark is nonsense, and the way the Python code is written is even worse. I looked at the "trig" and I/O benchmarks. In the i/o benchmark, the output is assembled in the stupidest way possible:
    linesToWrite = [myString]
    for i in range(ioMax - 1):
    linesToWrite.append(myString)

    Changing this to 'linesToWrite = [myString] * ioMax' dropped time on my system from 2830ms to 1780ms (I'd like to note that I/O on my system was already much faster than his *best* I/O score, thank you very much Linux)

    In the trig test, I used numarray to decrease the runtime from 47660.0ms to *6430.0ms*. The original timing matches his pretty closely, which means that numarray would probably beat his gcc timings handily, too. Any time you're working with a billion numbers in Python, it's a safe bet that you should probably use numarray!

    I didn't immediately see how to translate his other mathematical tests into numarray, but I noted that his textual explanation in the article doesn't match the (python) source code!

    (My system is a 2.4GHz Pentium IV running RedHat 9)

    --
    Hate stupid software on freshmeat? Laugh at
  61. Python Benchmark by SlightOverdose · · Score: 4, Informative

    The windows version of Python is much slower. Testing with Python2.3 + psyco on a 2.4ghz p4 running Linux 2.4.20 yeilds impressive results

    $ python -O Benchmark.py
    Int arithmetic elapsed time: 13700.0 ms with
    Trig elapsed time: 8160.0 ms

    $ java Benchmark
    Int arithmetic elapsed time: 13775 ms

    $ java -server Benchmark
    Int arithmetic elapsed time: 9807 ms

    (n.b. this is only a small subset of the tests- I didn't feel like waiting. Trig was not run for java because it took forever.)

    To dismiss a few common myths...
    1) Python IS compiled to bytecode on it's first run. The bytecode is stored on the filesystem in $PROGNAME.pyc.

    2) the -O flag enables runtime optimization, not just faster loading time. On average you get a 10-20% speed boost.

    3) Python is a string and list manipulation language, not a math language. It does so significantly faster than your average C coder could do so, with a hell of a lot less effort.

  62. .NET benchmark flawed. It is faster. by Anonymous Coward · · Score: 3, Insightful

    I see just one small issue with the benchmarks. Microsoft claims, that all .NET languages are compilled at the runtime. This means, that the first pass of the execution through the function has a compile time added on top of the execution, which falsifies somewhat the .NET execution time benchmark. I did some simple tests that confirm this. To my surprise, .NET languages are actually faster than Visual C++, Borland C++ or GNU C+ for a simple 1/n series calculation without visible loss of accuracy. Don't ask me how it is possible. I don't know, but it is a fact that my benchmark shows. My best guess would be that the just in time compiler is better in getting code optimized for the CPU in the particular machine it runs or maybe it is better in filling the cache. The key of the benchmark is to write software in such a way that it runs through the function at least two times. The first time it runs just to allow just in time compiler to compile the code and then it runs subsequent times to measure performance. Below is the schematics of my benchmark:

    double benchmark(int number_of_iterations);

    void main (void)
    {
    Time start,end;
    double outcome;

    benchmark(1); // This is to allow .NET "just in time" compiler to compile the benchmark function

    for(int i = 1; i < 11; ++i)
    {
    start = CurrentTime(); // CurrentTime is a placeholder here for a system time function in ticks
    outcome = benchmark(i*1000000);
    end = CurrentTime();
    lprt (i,outcome,end-start); // lprt is a placeholder for a nice formatting print here
    }
    }

    double benchmark (int number_of_iterations)
    {
    double s,t;

    s = 0.0;
    t = 1.0;

    for(int i = 1; i < number_of_iterations; ++i)
    {
    s += 1.0/t; // This is the body of the benchmark
    t += 1.0;
    }
    return (s);
    }

    As you can see above, I run the benchmark function once with counter of 1 and ignore its outcome before starting to measure time. The key is to allow compiler to compile the benchmarking function before running actual benchmark. Once it is done, I run then the benchmark 10 times for succesively larger counter from 1 billion to 10 billion and print number of iterations (in billions), the accuarcy and the time it takes to run. The idea here is that under the assumption that the benchmark time is related to number of iterations as a linear function I can easily find linear best fit function between number of cycles and run time in the form of

    time = a * number_of_cycles + b

    and then use value of a as a measurement of the benchmark. The value of b is good check, how the benchmark behaves. If it is large, then something went wrong. In my case it was always close to zero. I'm now away from my home computer and I don't have all the compilers, that were tested in this article, so I can't repeat those benchmarks modified to this method at the moment, but you guys might try to do it yourself.

    Some people might challenge this by stating that the compile time for .NET is part of the execution time but I disagree. My position on this is, that in most real life cases the software runs into the particular functions many times thus creating long exectution times. It is rare, that a signle function call creates long exectuion time that is annoying to the user.

    Best regards.

  63. Re:Benchmarks? Who cares? by Frobnicator · · Score: 2, Informative
    There never has, nor will there ever be, an all encompasing benchmark. ... Thin[k] of all of the parms which go into application performance. ... Think of the amount of impact the coder makes. ... How about compiling & linking flags?

    Not only that, but it helps to have a benchmark that actually tests the things that are claimed at being tested.

    It's a Good Thing (tm) this didn't make the front page.

    The author states "I am by no means an expert in benchmarking; I launched this project largely as a learning experience" and it shows. The man has an associates degree in computer science, and a Ph.D. in psychology. His list of publications are his dissertation, a single published paper, and excerpts within a 15-year-old travel guide.

    Just a cursory glance at the first page of his article shows that he has no clue as to how things work. He states "I first tried to eliminate the CLR from the Visual C++ benchmark by turning off the language's "managed" features with the #pragma unmanaged directive, but I was surprised to see that this didn't lead to any performance gains." If he cannot understand why something that generates a few thousand CPU instructions of initial overhead doesn't change the speed of an I/O- and loop limited program, he isn't skilled enough to interpret his own results.

    His benchmarks never actually test his first, second, third, or fifth question. His fourth question is actually addressed better when his contrived test is compared on relative measure with his two Java tests.

    Look at his benchmark programs (found here). Some of those test can, should, and will have compiler-specific optimizations, having nothing to do with the language. General 'counting loops', which is the only thing he is using, have long been known to produce bad benchmarks. He claims to be testing 64-bit floating point math, but in fact, many of his examples use 80-bit floating point.

    Just for fun, look at his VC and Java 1.4 floating point tests. Now look at his compiler options. It is painfully obvious that the compiler saw "He explicitly said this is a Pentium 4, I can use parallel floating point instructions!" where the other compilers could not. Saying that those languages are inherently faster than the other compiled languages is lunacy.

    This is hardly news. This is a BAD example of benchmarking, and would be given a poor grade in a graduate level CS class.

    --
    //TODO: Think of witty sig statement
  64. Microsoft's trig "functions" aren't by Anonymous+Brave+Guy · · Score: 2, Informative
    For many math functions java uses a software implementation rather than using the built in hardware functions on the processer.

    That would explain a lot then.

    Any recent version of Visual C++ supports "intrinsics", i.e., conversions of a function call directly into a specific machine code instruction, or "perfect in-lining" if you prefer.

    That means that if you use something like abs(x) in C++, these compilers would convert directly into an instruction to get x to the head of the floating point stack, then a FPU abs opcode, with no overheads at all. Same goes for trig functions and other variations supported by the FPU.

    Moreover, IME the VC++ optimiser is quite smart about intrinsics, and in lengthy calculations will often arrange for the right values to be coming to the head of the stack in the correct order as cheaply as possible, even if it means planning ahead a few instructions. If you look at the assembly language output from VC++ for a numerical computation, it tends to have a series of instructions to stack what it needs, with the occasional calculation opcode thrown in between them, and then a whole series of neatly co-ordinated calculation opcodes at the end.

    I don't see how any language that has function calling at all could keep up with this low-level, direct-to-FPU approach, and surely any language using software emulation of floating point code won't even come close.

    I don't know whether VC# and VB.Net use the same trick, but given how much effort MS put into sharing things across the product range prior to releasing VS.Net, it must be a good bet. There are some advantages to writing platform-specific code. :-)

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  65. Delphi & Kilyx by the_mushroom_king · · Score: 3, Insightful

    Why are the two best Borland languages never included in benchmarks? Maybe in just the odd-ball that doesn't use C++, Java, or Micro$oft. - TMK

  66. Reader/Writer classes in java benchmark affect res by mlamb · · Score: 2, Insightful

    By replacing the Reader/Writer classes in the java benchmark with their InputStream/OutputStream counterparts I realized a 24% IO performance boost when running the 1.4 JVM with the -server option. The Stream classes don't bother with the unicode conversions that the Reader/Writer classes do. Since the other benchmarks didn't perform unicode conversions (at least the C/C++ ones - can't speak for the other langs), this seemed like a reasonable modification.

    Curiously, without the -server option, this resulting in a 78% performance HIT.

    - Marty

  67. .NET is not Windows only by milsim · · Score: 2, Informative

    A few posts mention that .NET is for Windows only. That's completely untrue. .NET executables can be run on Linux, FreeBSD, MacOS X, maybe even other platforms in near future. .NET Runtimes: Mono - http://go-mono.com - C# and VB DotGNU - http://dotgnu.org - C# For Windows, the Microsoft's .NET Framework is the winner, being almost twice as fast as Mono, with DotGNU being the slowest, but I've only done synthetic SciMark2 benchmarks. (Also don't forget you can compile Java to .NET assembly :)

  68. wow, talk about a lame benchmark by autopr0n · · Score: 2, Insightful

    I mean, the functions are so simple, the code generated doesn't stress anything. Not any of the 'advanced' compiler, or even architecture features. None of the good features of a JIT.

    I mean seriously, they do math on all the ints from one to one billion. Why even bother? Adding large 32 bit ints takes exactly the same amount of time as adding small ones (but I guess you save one variable by doing math with the counter. Or one extra line of code saved)

    I'm sorry, but this is the most pointless compiler benchmark ever.

    A good language comparison would be to have a bunch of groups of people try to code up the best implementation they could in whatever language, of some complex problem, and use that as the baseline.

    --
    autopr0n is like, down and stuff.
  69. Wha? by autopr0n · · Score: 2, Informative

    You are completely wrong. Java programs are taken and converted into machine code on the target platform. Saying that it's "the same as 'C' code" because the JVM is written in C is like saying that if I were to write a C++ compiler in Python, running the resulting binaries would be the same as running Python code.

    In other words, idiotc.

    --
    autopr0n is like, down and stuff.
  70. Usefull and useless benchmarks by cimetmc · · Score: 2, Interesting

    I think enough other people have already pointed out that the kind of comparision done in this article is rather useless. Different languages are designed for different uses, and while some languages might favour faster code, other might favour ease of development or portability.
    Anyway, even when remaining within a same language or language family, the benchmarks are still quite meaningless. For instance when you want to compare the Performance of MSVC++ and GCC. The benchmark has several flaws:
    - the code is too trivial. It doesn't show how good the compilers really are at optimizing
    - the code is too library dependent. For instance, in the trig benchmark, only the runtime library is really benchmarked and not the code generated by the compiler itself
    - for the floating point benchmarks, the options chosen for both compilers do not match. For MSVC++, the options chosen favour speed over accuracy, while the GCC options favour accuracy over speed.

    The last point can very easily be illustrated with the trig benchmark.
    On my computer (P4, 2.8GHz), I get the following results:

    1) Options from the article: 10.9s
    2) additional option -ffast-math : 6.9s
    (this option is also a significant win for the double benchmark)
    3) options above plus linking with CRT_fp8.o : 2.8s

    The last option may need some explanation:
    Programs compiled by MSVC++ by default set the math coprocessor to 64bit, while GCC programs set it to 80bit. Linking with CRT_fp8.o on Windows platforms makes GCC programs behave like MSVC++ programs and only use 64bit precision. For arithmetic operations, this makes no difference, but the built in transcedental functions become much faster if you reduce the precision of the coprocessor. So all in all, be were able to reduce the speed of the trig benchmark by a factor 3.9 just by changing the compilation options. This is almost exactly the difference seen in the article between the MSVC++ and the GCC results for the trig benchmark.

    All in all, for trivial benchmarks like this, if you chose matching compilation options, different compilers give you almost the same results.

    The only real weakness that GCC is showing is 64bit integer arithmetic. These are badly implemented in GCC and could be vastly improved.

    Marcel

  71. Re:If speed isn't an issue by arevos · · Score: 2, Insightful

    I assume you don't acutally mean "standard" but "common".

    Unofficially standard ;)

    Does it have pointers or not? (Yes it does - and yes they are restricted - and the issues that that cuases is not overly severe).

    It has references, which aren't the same thing. C++ has references (e.g. char&) and pointers (e.g. char*). And yes, when I say it makes "pointers safer" I mean referencing. Whatever :)

    Java is a FAR, FAR, FAR, beter ___LANGUAGE___ than C++ - ignore the Vm, the libraries, etc... and look at the language - Java is way better.

    I have. I've used Java and C++ in two rather large projects. And I really can't see why Java is that much better. Or, indeed, that much different.

    I don't have to worry about pointers going astray (but then again, I don't have pointers full stop), or garbage collection, but apart from that, what's the difference? Ignoring the libraries, that the only thing I can think of that's different. Well, except that C++ has multiple inheritence, and so forth.

    Perhaps I've missed something. Could you explain why it is "way better"? Remember to ignore the Vm, the libraries and just to focus on the language.

    C++ would have been stillborn if it was not C-like - Java would have been if it was not C++ like.

    Agreed. That doesn't make Java a good language, though; that's just a reason why it's bad.

    That said, I've never really understood that argument. I mean, how long does it take to learn a new language? A few hours for an experienced programmer, really. Making Java C++ may have saved a day or so of programming time on one programming project, but that's nothing compared to how long software takes to develop. On the other hand, companies rarely act in a logical fashion when it comes to software.

  72. Athlon versus Pentium 4? by angel'o'sphere · · Score: 2, Interesting

    I think the author underestimates the impact of having Athlon specific optimizatins turned on for his c compiler(where applicable) while the Java HotSpot JIT compiler likely only optimizes very well for Pentium 4.

    Conclusion would be: the JIT compiled Java on an Athlon is poorly or not at all optimzed.

    Sidenote: the original author of the original benchmark wanted to compare .NET languages with Java and used gcc as reference as well. Interesting for me is that Java can compete with .NET.

    Further: obviously trig functions (which could be compiled to a single math processor opcode) are not optimzed at all in Java. From the language level calling a trig fuction is a call to a static method in the class Math. If that is "mapped" one to one to machine code it results in a JSR to the C function which contains only a few opcodes, but what a c compiler will compile to one opcode is in trivial 'mapped' Java about 10 opcodes.

    angel'o'sphere

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  73. Re:Time to defend C++ (again)... by Anonymous+Brave+Guy · · Score: 2, Informative

    I agree with 2/3 of your replies, but you need to look up the difference between C++ destructors and Java's finalize(). Hint: one is useful, the other usually isn't. :-)

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.