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."

954 comments

  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 Anonymous Coward · · Score: 0

      You mean, why are the others so slow with trig?

      MS faster? They must be cheating. It must be pre-loaded like IE is. They must be radioing home and telling Bill Gates about all the porno you download and every math calculation you do.

    4. 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.

    5. 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.
    6. 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).

    7. Re:Trig functions... by Ianoo · · Score: 1

      That's a good question, and I'd like to find out the reason. Is it possible that they're using different methods to compute the functions? There are several ways you can compute trig values, such as using taylor series approximations (e.g. sin(x) = x + x^3/3! + x^5/5! + x^7/7!...) or complex exponentials (sin(x) = (e^(jx) - e^(-jx))/(2j) ). I don't know which method is generally accepted as best for computer calculations. Maybe Java computes the approximations in Java code while in the CLR the function that actually computes sin(x) is unmanaged assembly code. I don't know.

    8. 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...
    9. 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.

    10. 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'
    11. 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).

    12. 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!"
    13. 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
    14. Re:Trig functions... by Billly+Gates · · Score: 1

      That makes a great argument for C#. Its easy for gui development and is better for the back-end and is lightyears ahead of java.

      Hopefully it will catch up soon.

    15. Re:Trig functions... by eples · · Score: 1

      That's a great point - and MSIL's performance in the Trig functions shows that bytecode languages don't inherently have slow Trig performance.

      So, back to my original question - what makes their implementation so fast?!

      --
      I'm a 2000 man.
    16. Re:Trig functions... by millette · · Score: 1
      helps to read the article:
      "Perhaps C++ is able to make better use of the Pentium 4's SSE2 SIMD extensions for arithmetic and trigonometry, but this is pure speculation on my part."
    17. Re:Trig functions... by Anonymous Coward · · Score: 0

      THIS TEST IS INSANE!!

      this stupid test does not test anything, really. its just a function call. sin/cos/etc are implemented as CPU instructions....

      here is the stupid code for the stupid java test by the way:
      <pre>
      while (i trigMax)
      {
      sine = Math.sin(i);
      cosine = Math.cos(i);
      tangent = Math.tan(i);
      logarithm = Math.log(i);
      squareRoot = Math.sqrt(i);
      i++;
      }
      </pre>

    18. Re:Trig functions... by tolan-b · · Score: 1

      amen...

      It's about time someone kicked Sun's arse hard enough to get them to swallow their pride and include the SWT native parts in the JVM (like Swing)

    19. Re:Trig functions... by g_goblin · · Score: 0

      Read the article carefully. The author did not create an unmanaged code project with VC++. So he actually wrote CLR code not pure C/C++.

      I was actually more surprised with gcc. I would have expected a lot better - even on Windows.

    20. 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.
    21. Re:Trig functions... by Merlin42 · · Score: 1

      *me dons asbestos underwear

      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.

      For real math/science stuff java is horrible. The math in java is sortf ieee, but not quite (and if you want/need ieee fp features they forgot about, oh well your screwed). If they had talked to anyone with any experience with numerical computing they would have relaxed the insane requirements on floating point math that would allow the JVM to use hardware to do stuff like trig when available.

      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'!!!

      EOR
      (End of Rant)

    22. Re:Trig functions... by damballah · · Score: 1
      Yes, this is to comply with IEEE p754, which deals with floating-point computing accross different platforms. Considering that java wants to be portable, this is very important. It also makes java a little more reliable programming language in this context.

      Java is almost ready for intensive numerical computations, what it is lacking is decent speed. This issue is being constantly addressed, thus the future looks promising for it.

    23. Re:Trig functions... by Anonymous Coward · · Score: 0
      I still say that a server written in C (written properly of course) will outperform a server written in Java.
      Get back to me in 10 years time when you've finished your C version. My Java version will have been in production for 9 years 9 months and served a billion satisfied customers.
    24. Re:Trig functions... by csnydermvpsoft · · Score: 1

      It's about time someone kicked Sun's arse hard enough...

      IBM?

    25. Re:Trig functions... by Hast · · Score: 1

      Actually I've seen pretty impressive demonstrations of Java on hard realtime systems. A industrial robot programmed in Java for instance. And you can upload new programming dynamically.

      As long as the program is correctly designed then the implementation is of lower importance. In many ways it can be a lot easier to make sure a fly-by-wire system is correct if it's written in Java (or other high level languages) than in Asm.

    26. 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.

    27. Re:Trig functions... by Glock27 · · Score: 1
      That makes a great argument for C#.

      We'll see...I'll rebut further down.

      Its [C#] easy for gui development

      So is Java (Netbeans, JBuilder and many more).

      and is better for the back-end

      ...in your humble opinion (not shared by many) AND solely if you want to run Windows. Not only do you have to run on a still inferior server OS, you are likely stuck there indefinitely. Nasty, and expensive in more than one way (dollars, lack of scalability, downtime, security issues...).

      and is lightyears ahead of java.

      An extremely debatable point. It's certainly not "lightyears ahead" in market penetration, or use on large server systems (or cell phones, or in embedded programming or...). As to features, Java is not set in stone, though it does tend to change a bit more slowly since it has an open improvement process. What is C#'s corresponding process for change?

      Hopefully it [C#] will catch up soon.

      What?!? You just said it was "lightyears ahead"! Make up your mind... ;-)

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
    28. 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.
    29. Re:Trig functions... by Anonymous Coward · · Score: 0

      But it won't be as fast!

      C zealots are funny.

    30. Re:Trig functions... by Aardpig · · Score: 1

      I don't know which method is generally accepted as best for computer calculations

      Taylor's series approximations are notoriously bad at converging to trig functions; you need many terms to even approach the true value, and that makes a series a bad choice for fast calculations.

      Using complex exponentials is just pushing the burden off onto the exp() function, and there is also the overhead of complex arithmetic.

      In fact, many modern high-performance compilers use look-up tables for trig functions, combined with some form of interpolation. For linear interpolation, you need a*log_2 (N) operations to find the correct position in the table (where N is the table size, and a is a small constant), and then 4 floating-point adds, 2 multipies, and 1 divide. Very fast!

      --
      Tubal-Cain smokes the white owl.
    31. Re:Trig functions... by Anonymous Coward · · Score: 0

      Not quite. Accurancy is preserved with Intel instructions. The problem lies with portability. But for most folks, that's no problem.

    32. Re:Trig functions... by FatherOfONe · · Score: 1

      Are the SWT libraries 100% java? or do they use Native widgets? I honestly don't know, but I have done a bit of development with SWING and have not found it to be slow at all. Yes JDK 1.2 was slow, but 1.3 and 1.4 SWING apps have worked well for what I do. Granted hardware has increased in the last 4 years also...

      What are you doing with SWT that can't be done with SWING and perform well? NOTE: I am not trying to start a flame war, but just understand.

      --
      The more I learn about science, the more my faith in God increases.
    33. 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.

    34. 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

    35. Re:Trig functions... by ajagci · · Score: 1

      This is (once again) proof that Java is not slow, in fact it's really fast.

      No, it is not "proof" that "Java is not slow". Doing well on those microbenchmarks is necessary to establish that Java is not slow, but it is far from sufficient.

      It's like saying that a Civic is a really fast car because you can make it go really fast by welding some booster rockets to it. That may be true in some sense of the word "fast", but that isn't a sense of "fast" that is going to be of any use to real drivers because, among other things, you can't steer the thing once you light the booster rockets.

      Java is not a good high performance language at this point. And, yes, that is a problem with the Java language, not just its implementations.

      Also, the memory use should be addressed by project Barcelona

      What 1.5 or 1.6 promise to address to some degree is excessive size of the code segment, by allowing code to be shared among multiple Java programs. But memory used for byte code and JIT output is only one of the ways in which Java memory usage is excessive; the Java language itself imposes lots of memory overhead on even simple data structurers and there is no indication that the Java language design is going to be changed to address that.

    36. 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 :)

    37. Re:Trig functions... by Anonymous Coward · · Score: 0

      oops... I meant AWT soz...

      -tolan-b

    38. 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.

    39. Re:Trig functions... by oever · · Score: 1

      Thanks a lot!
      That makes a huge difference in speed.
      Now this application runs much smoother.

      --
      DNA is the ultimate spaghetti code.
    40. 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/
    41. Re:Trig functions... by avandesande · · Score: 1

      Suns poor linux performance is well known. If you want fast give IBM's JR a try.

      --
      love is just extroverted narcissism
    42. 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.

    43. Re:Trig functions... by techiemac · · Score: 1

      Do you have a link to that? Now that would be cool to see. I would be interested in seeing the code benchmarks.

      Man, people think the moment you bring up an older technology, you're a nut ;)

      To answer an anonymous coward, it doesn't take 9+ years to write a server in C/C++ vs 9 months in Java . Granted if you were to do it in asm then, yes, it would take you a loooooong time :)

      But the point is that in a fly-by-wire system, you want to keep things somewhat predictable. Java adds too many layers to the system. In fly-by-wire systems, you need to be able to get to every layer, test all paths, test again, etc. Again, I'm not knocking Java here. Just some tools have their uses in some places but not others.

    44. Re:Trig functions... by mengel · · Score: 1
      Um... did you read the link? Particularly the part that said:
      4. The results of FSIN for inputs near PI and FCOS for inputs near PI/2 deviate greatly from the precision indicated in their documentation. This appears to be a problem that is not widely known and the rest of the discussion here deals with this problem.
      --
      - "History shows again and again how nature points out the folly of men" -- Blue Oyster Cult, 'Godzilla'
    45. Re:Trig functions... by inertia187 · · Score: 1

      Sites slow. Here's a [mirror].

      --
      A programmer is a machine for converting coffee into code.
    46. Re:Trig functions... by Billly+Gates · · Score: 0, Flamebait
      Enumorators? Reflection?

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

      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.

      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!

    47. 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
    48. Re:Trig functions... by mplex · · Score: 1
      ...in your humble opinion (not shared by many) AND solely if you want to run Windows. Not only do you have to run on a still inferior server OS, you are likely stuck there indefinitely. Nasty, and expensive in more than one way (dollars, lack of scalability, downtime, security issues...).

      And with java, you have to stick with an inferior software version of the JVM because it 's lots of extra work to make it run on all JVMs. Besides, a minor point version difference can break your app. Yea, java is wonderfully portable, rather than different hardware machines, you have to worry about different software machines.
    49. 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.

    50. 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!)
    51. 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.

    52. 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.

    53. Re:Trig functions... by EvilTwinSkippy · · Score: 1

      I think Linus said it best: I love standards. There are so many to choose from.

      --
      "Learning is not compulsory... neither is survival."
      --Dr.W.Edwards Deming
    54. Re:Trig functions... by Darren+Winsper · · Score: 1

      You don't think Java has reflection?! Oh dear...

    55. Re:Trig functions... by Anonymous Coward · · Score: 0

      C has a runtime also. just not for memory management as such but its there its called MSCVRT etd..

      EVERYTHING has a runtime. The issue is managed or unmanaged runtimes. Managed runtimes are here to satay, unmanaged = dying. bite it.

    56. 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".

    57. Re:Trig functions... by Anonymous Coward · · Score: 0

      What really burned Sun's ass is that Microsoft made Java useful for Windows client development -- they promoted native widgets over Swing, COM over JNI, MTS over J2EE, and so on.

      Nobody was under any impression that this stuff was cross-platform. It was adopted for the same reason that C# is being adopted -- RAD Windows Dev without having to use icky VB.

      Basically Sun cooked up a nice deep-fried shit sandwich with all their swing garbage, and was angry that Bill Gates and MS Devs didn't want to munch it down.

      Contractually, however, Sun only had a couple lame language extentions to sue them over. MS could have easily fixed that problem, but decided to get into a FUD war with Sun instead while they rewrote the thing from scratch.

      Net result: Java is dead on the desktop. Good job Guys!

    58. Re:Trig functions... by be-fan · · Score: 1

      SWT is far from native speed. Resizing Windows, has much more visible redraw, is much slower than, say, in Visual Studio. It also takes a long time to load, and menus items take a long time to respond while the thing gets JIT'ed.

      --
      A deep unwavering belief is a sure sign you're missing something...
    59. Re:Trig functions... by kberg108 · · Score: 0

      thank you for the dose of sanity. End the bigotry and code in as many languages as you can handle :) Respect language diversity.

      --
      I like things that are sweet and not things that are lame. --
    60. 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.

    61. 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.

    62. Re:Trig functions... by be-fan · · Score: 1

      Heh. I used to do graphics programming. When I say "divide" next to "Very fast" I burst out laughing. Divides were (probably still are) so slow that anything that includes one probably can't be very fast :)

      --
      A deep unwavering belief is a sure sign you're missing something...
    63. Re:Trig functions... by poot_rootbeer · · Score: 1

      there seems to be something wrong with Sun's implementation for Java.

      Perhaps Sun's is intended as a reference implementation, and is not optimized for performance?

    64. Re:Trig functions... by Anonymous Coward · · Score: 0

      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.

      It's pure Fanboy Trolling, but I'll reply.

      There's nothing about Java that would prevent you from writing "petshop" in a similar number of lines as the C# version.

      However, Sun has a financial interest in pushing these (usually very expensive) "J2EE App Servers" which demand programmers (or auto-generators) to write an enormous amount of bloated code just to fit the "design pattern". This mass of bloat of course sells a lot of hardware from Sun.

      This really doesn't matter that much however. The Microsoft programming world is similar to the Unix world -- get a bunch of skilled "hackers" and bash out the solution as quickly as possible. LOC really really matters in this situation.

      In Java World, programmers are for the most part cheap outsourced guys who are doing simple fill-in-the-blank J2EE template programming based on what an "architect" tells them to do. The cost may be greater, the code may be mega-bloated, but the results are very predictable.

    65. 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

    66. Re:Trig functions... by plumby · · Score: 1
      ease of programming (reduced development times)

      Have you used C#? I've been pretty impressed with it, having taken most of Java's good points. I hate to say it but, I think I actually prefer it to Java for most development tasks now.

      They are both a huge improvement on C++, as far as simplicity of development is concerned, though.

    67. Re:Trig functions... by Darren+Winsper · · Score: 1

      I'm not a fan of Swing, so I'll steer clear of that argument, however, I think you're over-simplifying by saying "MS could have easily fixed that problem" wrt the language extensions, because MS needed delegates to support the Win32 widget model and COM IIRC.

      I quite like delegates and C# in general, but I'm still not fond of the way MS went about trying to polute Java.

    68. Re:Trig functions... by Aardpig · · Score: 1

      Divides were (probably still are) so slow that anything that includes one probably can't be very fast :)

      Compared to a Taylor's series expansion, which requires a floating-point divide for each term, the single divide in linear interpolation is indeed very fast.

      --
      Tubal-Cain smokes the white owl.
    69. 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.

    70. Re:Trig functions... by Anonymous Coward · · Score: 0

      For real math stick with Fortran, SciLab or Matlab.

      Matlab? Please tell me you're kidding. Sure, it's a nice and powerful language, but it is horribly slow.

    71. Re:Trig functions... by MAXOMENOS · · Score: 1
      Reflection?

      Part of Java 1.2

    72. Re:Trig functions... by VertigoAce · · Score: 1

      Have you tried running Maestro from JPL? I have it on a 1.6GHz Pentium M (Intel says it's better than a 2.0GHz Pentium 4). It feels pretty sluggish and I would bet it's a result of using Java (in other words, a C++ version would be noticeably faster). Anyway, I agree with the rest of your post, just not the point that the issue doesn't matter with today's computers.

    73. 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
    74. Re:Trig functions... by Pieroxy · · Score: 1

      For real math stick with Fortran, SciLab or Matlab.

      Matlab? Please tell me you're kidding. Sure, it's a nice and powerful language, but it is horribly slow.


      Well, as stated by the parent, for real math stick with Fortran, SciLab or Matlab. Didn't say anything about performance, did he?
      You might dislike Matlab for its slowliness, but don't forget it solves a different type of problems than the others. As Always, use the right tool for the job.

    75. 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.

    76. Re:Trig functions... by be-fan · · Score: 1

      Of course. I was just thinking how different different peoples' idea of "very fast" can be!

      --
      A deep unwavering belief is a sure sign you're missing something...
    77. Re:Trig functions... by aminorex · · Score: 1

      Inlining, and "loose" results relative to IEEE-758.

      --
      -I like my women like I like my tea: green-
    78. Re:Trig functions... by Anonymous Coward · · Score: 0

      I totally agree with you. IMHO it's primarily not a problem of speed but the non-native look & feel that scares the common user and stigmatizes java apps as being crappy.

      Once this project matures it could do wonders for java on the desktop.

    79. Re:Trig functions... by dabuk · · Score: 1

      In addition MATLAB 6.5 now has a JIT compiler which gives much better performance in some instances. It doesn't work as well for all code, but it's the first version so I would expect it to get much better in future.

    80. Re:Trig functions... by Anonymous Coward · · Score: 0

      ok, i just wrote some trig functions based upon Maclaurin and Taylor approximations in java. My java functions outrun Math.cos and Math.sin!!! It only took 10 minutes!!!

    81. Re:Trig functions... by Aardpig · · Score: 1

      Of course. I was just thinking how different different peoples' idea of "very fast" can be!

      Having thought about the problem a bit more, linear interpolation can be done with no divides, if the abscissa spacing of the sample points is uniform. So, just FP adds and multiplies: fast, however you look at it!

      --
      Tubal-Cain smokes the white owl.
    82. Re:Trig functions... by FatherOfONe · · Score: 1

      Thanks for the input, but I still don't see the advantage. Most people that I deal with that use Java applications (not applets), have a modern JVM, or they can control what JVM is installed. How do they fit in to the rest of the desktop better? Does drag and drop work better? Again, I am not trying to start a flame war, but it seems that Swing is a constent, and will run on anything (NetWare, PDA, etc...) and SWT won't. It appears that SWT would run great on Windows, but may have issues with other OS'es.... Is that the case?

      --
      The more I learn about science, the more my faith in God increases.
    83. 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.

    84. Re:Trig functions... by Anonymous Coward · · Score: 0

      the gained security, stability and ease of programming (reduced development times) are worth the memory use increase.

      To who? That's a matter of opinion, and there are other ways to achieve the same things without the same sacrifices.

    85. Re:Trig functions... by mindriot · · Score: 1

      Probably not only that. Let's suppose that Java's trig functions are indeed native. The problem is, they're still functions which are called as standard class methods. In C, the trig functions themselves are compiled and thus of course native, but the complete overhead for making the function calls goes away, because ideally the compiler will even in-line the resulting code. I don't think this is done in Java.

      This would also explain why the standard math operations (+,-,*,/) are indeed fast -- they're mapped directly onto processor instructions. The trig functions, however, are functions, and are apparently not optimized like one would optimize such a function in a C/C++ compiler.

    86. Re:Trig functions... by Anonymous Coward · · Score: 0

      Actually, the specific legal problem wasn't so much with delegates, but instead the compiler directives and the fact they could be used even while in cross-platform mode, emitting invalid bytecode. There was also the greater issue that MS was behaving in an anti-competitive manner, not dealing in good faith, etc.

      I have no doubt that the technical issues could have been resolved had there been any will to do so. Sun just didn't want COM in Java and MS just didn't want to work with Sun to extend the language.

    87. Re:Trig functions... by Tony+Hoyle · · Score: 1

      Indeed... we run solely on Windows but used to do a fair amount of work every time Sun brought out a new JVM, simply because things changed each revision and more stuff broke as they were fixing the bugs from the last one.

      That stopped when we found a showstopper bug in Java 1.4 (doesn't work through proxies - acknowledged by Sun *over a year ago* and still not fixed) so had to go back to Java 1.2 and are sticking there until the c# rewrites are finished.

    88. Re:Trig functions... by bentcd · · Score: 1

      But the point is that in a fly-by-wire system, you want to keep things somewhat predictable. Java adds too many layers to the system.

      There is always rtj.org.
      --
      sigs are hazardous to your health
    89. 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.
    90. Re:Trig functions... by Pieroxy · · Score: 0, Flamebait

      The real puzzlement in this test is that all their tests (except IO) is independant code that is trivial to compile with a JIT. One area all these languages lags behind a native GCC code is memory allocation.
      The garbage collector, while adding programming comfort, is also adding a huge overhead. Of course, that was conveniently left out. I guess the author wanted to make a point rather than get a real-life test. I mean, in the real life, unless you are talking scientific application, you will deal with a great amount of memory allocation, not a 1000000 loop iteration to compute some kind of meaningless number.

    91. Re:Trig functions... by ckaminski · · Score: 1

      Right up until native java compilers make such an exercise moot... java, written in java...

    92. Re:Trig functions... by ckaminski · · Score: 1

      Which is more of a factor of your memory management routines themselves, as opposed to an OS limitation. Virtually no C/C++ library in existance today lets the OS make the memory management decisions for it; it's almost always some sort of memory pooling around the malloc/new library. There's no optimization to be gained here by Java alone.

    93. Re:Trig functions... by Nova77 · · Score: 1

      There is an optimization, because Java reserves a big bloc of memory that handle itself. Imagine a big chunk of memory (like 100 megs) allocated at the beginning by the VM: there's no real need for it, but there could be. This is one of the reasons why java needs so much memory. You can change the initial amount of memory (reallocated automatically if the program needs more) as parameter of java.

    94. 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...
    95. Re:Trig functions... by Thuktun · · Score: 1

      Sorry, dude, but SWT is nowhere *near* as complete as Swing, in terms of functionality. I know, I've tried to use it. [...] Worse, it's difficult to deploy, and even more difficult to use, as the documentation is remarkably incomplete.

      It's open source, no? Perhaps you could contribute.

    96. Re:Trig functions... by GrassyKnowl · · Score: 1

      Funny, I experienced that the speed of the GUI is quite acceptable under Java.

      Anyone who has used JBuilder, a Java application, knows that the GUI of JBuilder is quite fast.

    97. Re:Trig functions... by canajin56 · · Score: 1

      It works fine with Windows, Linux (Motif or GTK), Solaris, QNX, AIX, HP-UX, and Mac OSX. They fit with the rest of the desktop better for a few reasons. One, they LOOK just like the rest of the OS. Two, they are faster. I'm not sure about drag and drop, however.

      As for not running on anything...I'm not sure about that. Having read the white paper a while ago, I seem to recall that if the platform doesn't have a widget that SWT needs, it uses its own implementation. Either way, it works fine with Win32, GTK, Motif, Photon, and Carbon for sure.

      --
      ASCII stupid question, get a stupid ANSI
    98. Re:Trig functions... by mjc_w · · Score: 1

      I would be interested in seeing your code.

      How well does it work for large arguments (pi*10^8+.001 for example)?

      Argument reduction is essential for accurate trig functions. See "Software Manual for the Elementary Functions" by Code and Waite for a good discussion.

      --
      This is the Constitution.This is the Constitution under the Bush administration. Any questions?
    99. Re:Trig functions... by Anonymous Coward · · Score: 0

      Oh, great. Now this whole article will go off on a tangent.

    100. 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.

    101. Re:Trig functions... by Abcd1234 · · Score: 1

      Err, it's IBM's baby... if they wanted it used by the common man, they certainly have the resources to make it so. Meanwhile, I have better things to do.

    102. Re:Trig functions... by dnoyeb · · Score: 1

      ...making the allocation sometime even faster than C.

      I suppose its legitimate to say one C program is faster than another. Considering, as I have said, they are both C programs.

    103. Re:Trig functions... by aled · · Score: 1

      I doesn't says so. But others implementations may be faster in some aspect or in general. From the bechmark I think there's a bug in 1.4.2 performance.

      --

      "I think this line is mostly filler"
    104. Re:Trig functions... by aled · · Score: 1

      Other than MS in windows you don't have a robust, complete, supported, known implementation with years of experience and products/libraries (like in AS/400, Linux, Unix?). And no, mono isn't ever near that.

      --

      "I think this line is mostly filler"
    105. Re:Trig functions... by Pieroxy · · Score: 1

      Well, I agree that allocation and deallocation can be simpler in GCs. That would be basically because the GC knows what he is doing and have a consistent behavior, where a manual allocator doesn't have a clue what the program is doing in advance.

      However, the complexity that is removed from the programmer with a GC - when and what to free - is obviously a job that manual memory managers doesn't care about. Is this complexity adding a huge overhead? I don't necessarily think so, but it might depend on the GC and the program involved. Again, there is no "All purpose" perfect solution. A gc is a good compromise - especially with large projects/lazy programmers - but it might prove to be less efficient for some specific tasks.

      I would have liked a memory management section to the test to illustrate this point though. This way we wouldn't have to speculate.

    106. 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.

    107. Re:Trig functions... by ArtDent · · Score: 1

      And the problem is that AWT is a lowest common denominator approach: if you can't do it natively on every platform, don't do it on any platform. Since that gives you very little to work with, Sun decided to try again and made Swing. As you describe, they reimplemented a whole widget set in Java.

      So, before SWT, your choice was the inadequate AWT or the slow and ugly Swing. The fact that no one really seems to remember what a pure AWT application looks like tells us that most people chose Swing, as they wanted or needed the features.

      Now, we can choose SWT, which is fast, featureful, portable, and looks great, too. Of course, there is some Write Once, Debug Everywhere involved. (Example: TableTree doesn't indent on GTK+ like it does everywhere else). But, as Eclipse has shown, that's manageable. Don't tell Sun, but you're never really going to get Write Once, Run Everywhere to work perfectly for UI's, with no debugging, anyway.

    108. Re:Trig functions... by Sinical · · Score: 1


      No. Math in Java == slow, I believe because Java's specification has very strict standards about floating points results, etc., that cannot always be performed correctly in hardware, so you have to fall back to software.


      I know that in even basic stuff that we do, I often try implmentations in both C++ and Java, and C++ whoops Java. Simple recursive Fiboannci:


      C++ (well, C, too I guess)


      int
      f(const int n)
      {
      if( n <= 2) {
      return 1;
      } else {
      return f(n-1) + f(n-2);
      }
      }

      >fib 42
      Calling recursive fib for 42.
      Result == 267914296 Diff == 3.6250

      public static int f(int n)
      {
      if( n <= 2) {
      return 1;
      } else {
      return f(n-1) + f(n-2);
      }
      }

      >java fib 42
      Computing Fib #42
      result == 267914296 diff == 5282.0


      Ratio is ~1.46:1.

      This is:


      Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.00.9466 for 80x86 and the Java stuff is v1.4.1. It only gets worse from here. This is simple integer math.

    109. Re:Trig functions... by tjansen · · Score: 1

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

      You are missing one point though: GCs can be better at cache utilization than manual heap memory management, but they don't even come close to stack-allocation, neither in cache utilization (almost immediate re-use the hottest cache) and nor in overhead for memory allocation (allocate as many objects as you want with a simple add).

      A good C++ program would do almost all memory allocations on the stack, and not on the heap. Only the long-living objects need to be on the heap.

    110. 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.

    111. Re:Trig functions... by Natty+P · · Score: 1

      Sorry, I haven't used Maestro, but *if* they used Java, the sluggishness most probably comes from a bad design rather than simply using Java.

      The biggest contributor to this is probably either using no multithreading in the program, or using it incorrectly.

      I also love it when someone complains about how slow their application is in Java compared to 'language X', and when you look at their code it's some weird procedural mishmash of Java with lots of inefficient implementations of things that are already provided by the Java API.

    112. Re:Trig functions... by aminorex · · Score: 1

      Andrew Tannenbaum said it before Linus did.

      --
      -I like my women like I like my tea: green-
    113. Re:Trig functions... by autopr0n · · Score: 1

      Java is not a good high performance language at this point. And, yes, that is a problem with the Java language, not just its implementations.

      Erm, did you read the article? If you stay away from trig functions, your code should be as fast as VisualC++, and faster then code compiled with GCC. How is that not "high performance"?

      --
      autopr0n is like, down and stuff.
    114. Re:Trig functions... by ckaminski · · Score: 1

      A C compiler will do no inlining of trig functions in a library without source available. A java's version of log10(e) and a C libraries version of log10(e) are very likely similar at an instruction level. A C/C++ compiler that has source available for the log10(e) function might do function inlining in loops for the code, but might not if the execution unit is too large. It's a crapshoot, and completely up to the optimizer.

      Note that a Java compiler could also do loop unrolling and inlining optimizations as well. Sophistication of Java compilers is probably not there yet though. :-/

    115. Re:Trig functions... by plumby · · Score: 1

      True, but then I was talking specifically about the productivity of the language. I wouldn't recommend .NET as an enterprise server platform, but pretty much all of the actual coding that I do these days is for my own benefit, and the odd prototype, and C# is ideal for these.

    116. Re:Trig functions... by You're+All+Wrong · · Score: 1

      Maybe because they are less precise or do not fully implement IEEE behaviour. There are 'fast math' libraries for various architectures which cut various corners and can be 2 or 3 times faster than the native libraries.

      YAW.

      --
      Your head of state is a corrupt weasel, I hope you're happy.
    117. Re:Trig functions... by Unoti · · Score: 1

      One thing I've not seen mentioned in this Swing discussion: Swing is far cleaner to program and easier to build software in than Visual C++. Visual C++ is easier for small apps, perhaps, but I'm talking about writing large enterprise apps with hundreds of screens.

    118. Re:Trig functions... by ckaminski · · Score: 1
      Java is not a good high performance language at this point. And, yes, that is a problem with the Java language, not just its implementations.

      I contest this point, simply because the same could be said of C++. If C++ were built on top of an interpretive VM, you'd argue that C++ was a poor language? There exist Java -> native machine compilers today that generate binary code similar to what a C++ compiler would do. Java->native compilers are much less sophisticated than the optimizing compilers of Intel or Sun, but are getting better.

      Your comment against VM's is valid. Your comment against the language is not, except as perhaps regards the garbage collector. Would you accuse a C++ garbage collecting memory manager of being "not good in high performance computing"? Even there is a moot point, because a smart Native Java implementation could implement smart self-destructing objects without needing garbage collection.

    119. Re:Trig functions... by Anonymous Coward · · Score: 0

      uhm... 'looks to me like math.h (Visual C++ 6.0)is using ANSI C 4.5 math functions as C Runtime Imports... (starting with comment on line 199 of that file, for fp trig function proto).
      one of the few times that MS VC++ is actually ANSI complient.

    120. Re:Trig functions... by Anonymous Coward · · Score: 0

      Easy. The MS programmers are smarter !

    121. Re:Trig functions... by aled · · Score: 1

      Ok, I was thinking of an enterpise production environment. For personal use, or low risk projects C# may be fine. For me C# hasn't crossed the threadhold of advantage over Java, but I would like to play with it.

      --

      "I think this line is mostly filler"
    122. Re:Trig functions... by Anonymous Coward · · Score: 1, Informative

      First, I am not impressed that Java is faster for some benchmarks. Note: That it uses a JIT-compiler and the JIT-compiler has runtime information. Static compiler as gcc cannot take advantage of runtime info. So with a good JIT-compiler and for benchmarks that runs for some time Java programs can be faster that natively compiled code provided that the JIT can remove most array bound checks.

      Trigonometric functions are not part of the Java language but they are the Java library.

      I think it is slow for the trig functions because of the overhead to call the native OS trig function (switch from Java to native).

      They are probably implemented something as this in class Math:
      public native double cos(double v);
      and the native funcion is:
      jdouble Java_lang_Math_cos(jdouble v) {
      return cos(v);
      }
      The switch from Java to native code involves some overhead. For I/O it does not matter much, I/O is already slow. But if you have trig function in a tight loop, then you have quite some overhead unless the JIT is smart enough to handle special cases and inline directly the cos(v) native code.

    123. Re:Trig functions... by Pieroxy · · Score: 1

      the slow and ugly Swing

      While I agree that the first versions were slow and ugly (JDK 1.2 and before), it is not anymore. There is a lot of good looking look and feel out there and computers have evolved so that it is really acceptable in terms of speed.

    124. 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

    125. Re:Trig functions... by jrduncans · · Score: 1

      That doesn't at all explain the drastic increase from Java 1.3 to 1.4.

    126. 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.

    127. Re:Trig functions... by matfud · · Score: 1

      The CPU instructions on intel hardware do not meet the standards that the JLS requires. Therefore they cannot be used and a software implementation is needed instead.

      This isn't quite true as java contains two different classes for Math functions such as this. One, Math, is supposed the be less standards complient but faster then the other, StrictMath. In jdk1.4 Math and StrictMath are actually the same code. But then the JDK released by sun is only a reference implementation.

      matfud

    128. Re:Trig functions... by herc_mk2 · · Score: 1

      wow - that link is a fascinating read. Nice to know that so much math computation is potentially broken.

      Vaguely reminiscent of the FP errors in the first batch of Pentium chips...

    129. Re:Trig functions... by Abcd1234 · · Score: 1

      Maybe, but most *users* will chose a SWT app over a Swing one anytime.

      Umm, I think you're missing the point. Who cares if users prefer SWT over Swing. The problem is that SWT will rarely be chosen by *developers* because 1) it's incomplete, 2) poorly documented, 3) buggy, and 4) difficult to deploy.

      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.

      Actually, I disagree with this. Have you ever used JEdit? It's not my cup of tea (I prefer Emacs), however despite being a Swing app, it's remarkably capable and responsive.

    130. Re:Trig functions... by butane_bob2003 · · Score: 1

      I agree here. This is the same limitation that AWT had, finding and supporting the intersection of UI controls common to the popular windowing systems. I prefer Swing over either one, on a fast machine the performance is not much of a problem. Also, after using a Swing app for a minute or two, things usually start to speed up considerably due to to the JIT compiler doing it's duty.

      --


      TallGreen CMS hosting
    131. 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...
    132. Re:Trig functions... by Anonymous Coward · · Score: 0

      Good answer. I wouldnt contribute to any project like this where a big greedy company wants to benefit from my free work, and in the process laying off a bunch of other software engineers that are working on similar projects. OSS is a good concept, but when some one else makes money off your work and you are left holding the bag... not a model in a greedy world.

    133. Re:Trig functions... by butane_bob2003 · · Score: 1

      Just a little clarification:

      NIO == Non-blocking IO
      The parent->parent is incorrect in thinking this meant 'new' IO. Like the parent said, it is IO for a different purpose. Its there to remove some of the details of multi-threading from parallel IO in applications like p2p, media streaming, messaging, etc..

      --


      TallGreen CMS hosting
    134. Re:Trig functions... by Anonymous Coward · · Score: 0

      I wouldnt use SWAT for anything. I tried to use it once and hated the API. Till the SWAT team learns how to write better and complete APIs, I prefer Swing.

    135. Re:Trig functions... by Anonymous Coward · · Score: 0

      Considering that the whole imaging model isn't Swing, I don't think what you said is entirely correct. I haven't look too much into SWT, but I'd assume that you could still use the same image APIs while using SWT in place of Swing.

    136. Re:Trig functions... by EvilTwinSkippy · · Score: 1

      Linus probably has as many mis-attributed quotes as Benjamin Franklin.

      --
      "Learning is not compulsory... neither is survival."
      --Dr.W.Edwards Deming
    137. Re:Trig functions... by pico303 · · Score: 1

      I've done a ton of both Swing coding and SWT coding. True, with Swing you can do some great/goofy stuff to your UIs, but you can only do that because you're basically drawing graphics on top of a blank slate.

      SWT uses OS widgets natively where possible. No, it can't do everything that Swing can, but it is extremely robust. Add JFace on top of that, and I can do everything I need to in SWT/JFace, without the horrible overhead of Swing GUIs. Plus, SWT's design is much, much cleaner than Swing.

      As an example, it took around 40 lines of code in a single class to implement my drag and drop routines in SWT/JFace. The same functionality took three classes, several "cheats," and hundreds of lines of code under Swing.

      And it really, truly does run well. Users always complained about the responsiveness of the Swing apps. Not a peep about the SWT/JFace ones. And they run much faster.

    138. Re:Trig functions... by matfud · · Score: 1

      Actually I need to refine that a bit. The Math class was renamed StrictMath and forces bit level reproducable results on all platforms. The requirements for the Math class were then reduced to allow for faster implementations. However Suns implementation of Math calls the functions in StrictMath.

    139. Re:Trig functions... by TheAJofOZ · · Score: 1
      They are not indicative of real-world performance, unless all you are doing are such loops.

      If you've ever done much optimization work, you'd realize that most programs are speed limited by a few small, often simple loops that just happen to execute an expensive operation or just plain run a lot. So while micro-benchmarks are never perfect, these ones aren't too bad at reflecting what actually happens in real life programs.

    140. Re:Trig functions... by pjrc · · Score: 1
      If I use java then I have to stick to the decisions made by someone else....

      This can be said of any compiled language, where the language designers and compiler implementation and library impose an environment upon you.

      In fact, even if you code in assembly language, you still have to stick to the decisions made by the chip designers... using only the opcodes and addressing modes available, and working within the memory management and peripheral hardware.

      Even if you design your own system board, you still have to stick to the decisions made by the engineers who designed the leading microprocessors, memory, peripheral devices and system chips.

      Even if you design in FPGA-based reconfigurable hardware, you are still stuck with the design decisions of the "fabric" of logic blocks and interconnect. If you use Verilog or VHDL (the only really well supported way to design with these chips nowadays), you also have to stick with the quirks of the languages and implementation decisions within those silicon compilers.

      If you drop down to standard cell or gate array custom ASIC design, you are still stuck with the cells and gates that come in the librarys.

      Even if you go all the way down to full custom ASIC layout, where you can draw the shape of every transistor (I did a small chip, approx 6000 transistors, this way in the early 90's as a grad student project).... you STILL have to stick with sets of design rules imposed by the fabrication process that will manufacture the chips for you. And if you have any ambition of scaling your design to smaller geometry processes (eg, 0.13 micron to 0.09 micron or 90 nm), you'll probably use "scalable" design rules that impose some artificial limits that allow scaling as process geometries shrink. Likewise, you must of course stick to "rules" imposed by the capacitive loading of transistor gates and the transconductance (drive strength) of the transistors... setting ratios properly, and so on.

      You're pretty much always going to be stuck with decisions someone else has made, no matter what tools you design with.

    141. Re:Trig functions... by jerktar · · Score: 1

      SWT is not as complete as Swing, but thats the trade-off, SWT is faster since your using native widgets. The new SWT 3.0M6 milestone has support for embedding AWT/SWing components inside SWT composites. Also if you need to build your own widget in SWT you can (by using the SWT graphics api). Furthermore, SWT is cleaner, though you do have to manually dispose certain objects such as fonts and colors. One gripe about SWT is that although the layout managers seem to be cleaner I am having trouble making them do what I want. Making a composite scrollable is also a pain in the ass, where Swing it is relatively easy. I decided to use SWT when I saw Azureus (bittorrent client), which looked really good and performed well, abd was easy to install. Deploying SWT apps is really not that hard, you just have to install an extra library which is easy in JWS. Furthermore there is lots of native support if you know you are going to run primarily on one platform. Also java's browser was crappy last time I used it and work on the SWT browser is promising. Write once, run/test everywhere is a benefit of AWT/Swing, but for GUI stuff you need to be able to expand functionality that perhaps can only be used in particular enviroments (like creating a systray icon in windows). Also Image support is lacking but if you know what you are doing, you can use JAI (java advanced imaging) to do image manipulation, and generate (SWT) ImageData objects from their output (using IO streams). This is what I am doing now and I am getting good performance. SWT also uses hints when computing sizes which Swing doesn't do and this is necessary when you are trying to calculate preferred sizes on multi line text which is a nightmare in Swing. I haven't done much "cell" rendering type stuff but in SWT you are restricted to text and image objects for native widgets which makes sense. THis new support for swing embedded in SWT composites might fix this but it would be nice to have your own Canvas objects in a native widget although i dont see how that is possible. At least sun now has native L&F support in 1.4.2 which is nice. Anyway, both have their strengths and after using SWT I am impressed enough to continue using it.

    142. Re:Trig functions... by tjansen · · Score: 1

      Umm, I think you're missing the point. Who cares if users prefer SWT over Swing.

      Those who write software in the hope that users use it.

      Actually, I disagree with this. Have you ever used JEdit?

      Yes, it is responsive, but it looks&feels bad.

    143. Re:Trig functions... by ProfKyne · · Score: 1

      Don't buy too heavily into the "fast" of SWT. It's not fast at all on MacOSX. However, it is blazing fast on Windows. But then again, there are some blazing fast Swing apps on Windows too.

      At work, on my Win2k machine, I use WebSphere Studio Application Developer (which is basically just Eclipse with a bunch of extensions from IBM). WSAD/Eclipse is a SWT application, and its performance is excellent. Yes, you can tell it's not written with MFC, but it's very very fast. But I also use jEdit (for stuff like Python or PL/SQL), and it's just as fast, if not faster sometimes. And that's written in Swing.

      --
      "First you gotta do the truffle shuffle."
    144. Re:Trig functions... by SchroedingersCat · · Score: 1
      - 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.
      That is not necessarily so. For example, if you take a look at Apache memory management routines then you will see that everything is allocated from the pool which is dropped entirely once the request is processed so you don't have to bother deallocation memory at all. The point is that manual momory management will always be more efficient that GC because it can be tailored to the task at hand.
    145. Re:Trig functions... by gangien · · Score: 1, Offtopic

      I made a pong game in Scheme, and I had that problem. GC would cause my game to freeze up and it was really pretty bad. So instead I told it to GC every loop, lagged the game, but it was consistent so far less noticable.

    146. Re:Trig functions... by Abcd1234 · · Score: 1

      Those who write software in the hope that users use it.

      Yeah, sounds great. 'course, if I can't actually *write* the damned app because the toolkit isn't complete, or because it doesn't work on my (or my users') platform, or because I can't figure out how to use it because the documentation is all but non-existent, it makes the prettiness of the GUI a moot point, now doesn't it?

    147. Re:Trig functions... by alannon · · Score: 1

      Please mod this up. This is -VERY- important to note. I believe what basically happened is that Math BEFORE 1.4 was ALWAYS strict. Adding a StrictMath class gave Sun the flexibility to specify that the core Math class could be 'not strict' and could be optimized. I wonder if anyone who has access to 1.5 beta versions could let us know if its Math class is 'fast'.

    148. Re:Trig functions... by Anonymous Coward · · Score: 0

      Depends on what is 'good' for you. If you're writing security-crtitcal app then if you allocate memory on stack then you have more ways to smash the stack. And exploiting stack overflows is much more easier than exploiting heap overflow.

    149. 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.

    150. Re:Trig functions... by Mawbid · · Score: 1

      Uh, yeah. That's why Eclipse itself is such a snappy, responsive product.

      --
      Fuck the system? Nah, you might catch something.
    151. Re:Trig functions... by Wavicle · · Score: 1

      [(3!*5!*7!*9!)x - (5!*7!*9!)x^3 + (3!*7!*9!)x^5 - (3!*5!*9!)x^7 + (3!*5!*7!)x^9] / [3!*5!*7!*9!]

      Will give you the first 5 terms of a taylor series for sin(x) at a cost of 9 multiplies, 4 add/subtracts and 1 divide. Additional terms cost 2 multiplies and 1 add/subtract each.

      You can do a taylor expansion with one divide and reasonably low cost for the accuracy.

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    152. Re:Trig functions... by tjansen · · Score: 1

      No, it doesnt. Because I, as a user, don't care about the toolkit's documentation. I either use it, or I don't. And I refuse to use any IDE (like Netbeans) that uses Swing.

    153. Re:Trig functions... by Anonymous Coward · · Score: 0

      Actually, division isn't as slow as it used to be. Sure, division was slow when you had to do it bit by bit, with one clock cycle per bit, but modern dividers use a lot of tricks like fancy SRT tables to predict quotient bits to process multiple bits per clock cycle, and chaining together multiple subdividers for even more speed. I believe the old Cyrix 6x86 could even do a 32-bit division in one clock.

    154. Re:Trig functions... by AArmadillo · · Score: 1

      Most likely they use the 80x86 FPU instructions (FSIN, FCOS) that calculate these values in a matter of 16-126 clock cycles. I don't know why the other compilers/languages don't, though.

    155. Re:Trig functions... by be-fan · · Score: 1

      This is true. When I referred to manual memory management, I was referring to malloc()/free() used like it is in most programs.

      Now, there are a number of techniques that can be used to provide some of these benefits through compiler optimizations (region inference and automatic pool allocation, for example) but you are right that manual memory management will always be more efficient. The questions are: how easy is it to get efficiency to that level, how often you need that level of efficiency, and how often to people actually bother to reach optimal efficiency. The answers to those questions usually speak strongly for the benefits of GC.

      --
      A deep unwavering belief is a sure sign you're missing something...
    156. 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)

    157. Re:Trig functions... by Anonymous Coward · · Score: 0

      It is a problem of the tan and log functions
      of the GCC compiler on cygwin.
      Using his benchmark I get 14.4 sec. on my
      2 GHz pentium with cygwin but 3.5 sec.
      on the same laptop with SuSE 9 and the same
      GCC version (3.3.1)
      The trig benchmark uses sin, cos, tan, log and sqrt. Here the results for 10 million calls for
      each function individually (first column=cygwin,
      second column=SUSE, result is in seconds)

      sin 1.03 1.01
      cos 1.03 1.01
      tan 10.54 1.19
      log 1.92 0.57
      sqrt 0.21 0.22

    158. Re:Trig functions... by Aardpig · · Score: 1

      Will give you the first 5 terms of a taylor series for sin(x) at a cost of 9 multiplies, 4 add/subtracts and 1 divide. Additional terms cost 2 multiplies and 1 add/subtract each.

      I actually count 19 multiplies; it appears you missed the multiplies which are implicit in raising x to a power.

      You can do a taylor expansion with one divide and reasonably low cost for the accuracy.

      Except that the expression you gave isn't accurate at all; you have confused high order with high accuracy. Your expression gives sin(2*pi) = 11.9, which is way off the true value of sin(2*pi)=0. At x=pi, your expression is rather more accurate (0.00693, as opposed to the true value of 0), but still not good enough for any numerical calculations.

      --
      Tubal-Cain smokes the white owl.
    159. Re:Trig functions... by Anonymous+Brave+Guy · · Score: 1
      The questions are: how easy is it to get efficiency to that level, how often you need that level of efficiency, and how often to people actually bother to reach optimal efficiency.

      I think you've pretty much nailed it there. You can write your own GC with whatever properties you like using manual memory management, but not the other way around. Hence, in extreme cases, a manual scheme implemented by skilled programmers with a well-customised design will always win.

      It's a similar trade-off to "just-in-time" compilation that can do dynamic optimisation vs. a fully-compiled program with compile-time optimisation. You can always write the former using the latter if it's worth it.

      In each case, extreme cases demand the manual, fully customisable solution. However, most real world problems are not that extreme. In the remaining cases, the safety and usability advantages of the more automated approach probably outweigh the fact that they're only X% as good.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    160. Re:Trig functions... by Aardpig · · Score: 1

      Oh, and you also forgot the multiplies needed to calculate the factorials...

      --
      Tubal-Cain smokes the white owl.
    161. Re:Trig functions... by Anonymous+Brave+Guy · · Score: 1
      If you're writing security-crtitcal app then if you allocate memory on stack then you have more ways to smash the stack.

      That's true, of course, but it's a bit of a straw man. The problem in that case is that you were writing a security-sensitive application using tools that allowed direct access to too much of the stack in the first place.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    162. Re:Trig functions... by shemnon · · Score: 1

      If you are writing windows applications to an english-only audience you are right, C# and absolute positioning is a very fine solution. But once you do I18N into a language line norwegian or traditional chinese (or both at the same time) then you will get the point of layout managers.

      And clearly this means you haven't used Eclipse on a Linux box, try playing with the tree in a real production project with 1000+ source files (not just java code) and you will see it crawl like an injured turtle.

      But in an english-only and windows-only world, you're right: C# rules and absolute positioning is all you need. The other 80% of the world (and I do mean world) will use other solutions.

      --
      --Shemnon
    163. Re:Trig functions... by Random+Frequency · · Score: 1

      There are documents out there that describe how to write 'faster' math implementations using JNI and 'sqrt', et al.

      In order to maintain compatbility with IEEE-math, they reimplemented the routines in java bytecode.

    164. Re:Trig functions... by MechaStreisand · · Score: 1
      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.
      Not on any modern OS I've ever seen. Operating systems that use paging, which is most of them, do not work this way. The memory they give to processes is not necessarily contiguous: it doesn't have to be, as it stores a mapping of virtual memory pages to real physical pages.

      An array that spans, say, 50 pages could be scattered all over physical memory, but because its virtual addresses are still contiguous, that doesn't affect how it's accessed from within the process.

      If the Java VM actually does allocate all the RAM at the beginning, that's horribly inefficient. It's much, much better to let the OS manage memory instead of letting a process take far more than it needs. Unless the java process is all you care about...
      --
      Disclaimer: IANAL. This post is, however, legal advice, and creates an attorney-client relationship.
    165. Re:Trig functions... by Kent+Recal · · Score: 1

      Does it support a custom editor (can I use vim)?

    166. Re:Trig functions... by Doppler00 · · Score: 1

      My guess is that C++ will compile trig functions directly into assembly level instructions for trig, since these do exist in the FPU of the x86 class processors. I'm not sure if Java even has this capability, it may actually be calculating trig functions using java primitives. I guess that's part of the entire cross plaftorm aspect of it, being that some processors might not have a FPU with sin and cos functions? That's only my guess though.

      It could also be the overhead of calling Math.sin() as a function instead of in C++ where it should correctly optimize it to a single assembly instruction without an unneccessary function call.

      The easiest way to answer this to reverse engineer the compiled code into assembly and see the different stratagies the compilers use for optimization.

    167. Re:Trig functions... by Wavicle · · Score: 1

      I actually count 19 multiplies; it appears you missed the multiplies which are implicit in raising x to a power.

      I think I only missed one multiply.

      For raising x to a power, you only need one multiply each iteration and two variables: x2 and xp. x2 = x^2, this calculation must be performed once per call (it is the one I missed). xp = x for the first term and xp * x2 for each successive term (x*x2 = x * x^2 = x^3, x*x2*x2 = x * x^2 * x^2 = x^5, ...).

      Constant multiples of constants are constants. Therefore (3!*5!*7!*9!), (5!*7!*9!), (3!*7!*9!), (3!*5!*9!), and (3!*5!*7!) are *zero* multiplies each. They are constants, leave them to the compiler, or if you're doing assembly pre-calculate them in a macro.

      So each term requires the xp*x2 multiply, the multiply by the constant factorial term, and the add or subtract to the accumulated value.

      The total will be 2 multiplies for the first term (calculating x2 and the constant times x) plus two multiplies and an add/subtract for each after that. So for 5 terms it's 10 multiplies, 4 add/subtracts and one divide.

      Except that the expression you gave isn't accurate at all; you have confused high order with high accuracy. Your expression gives sin(2*pi) = 11.9, which is way off the true value of sin(2*pi)=0. At x=pi, your expression is rather more accurate (0.00693, as opposed to the true value of 0), but still not good enough for any numerical calculations.

      That taylor series was centered around 0 (so technically it was a maclaurin series), if you are using that series on 2*pi, you've messed up your numerical analysis. Values fed into that function should be in the interval (-pi,pi]. If they are outside that interval, fix them so they are. You are going to have to do that with interpolation as well, you aren't going to have your LUT go from (-infinity,infinity). If you'd prefer values in the range (0,2pi], you could just recenter the taylor series around pi.

      You shouldn't use just 5 terms anyway, writing out the equation for more terms seemed unnecessary. The mathematical analysis behind it (find a common denominator so you only have to do one divide) was the important thing.

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    168. Re:Trig functions... by j-pimp · · Score: 1

      Managed runtimes are here to satay, unmanaged = dying. bite it. Their will always be a place for both. The Texas Instruments graphing calculators all have less then a meg of ram. I doublt anyone would port a jvm or Mono to them. Theirs always going to be a new CPU. Someone is gonna have to write some assembly into one of them new fangled modular kernels like the hurd to get it to boot. Then they got to write a C compiler that GCC can bootstrap from. Afterwards they got to compile Java and Mono, then we can start writing managed code. Now I am not an expert in compiler or OS design. I also realize their are things such as cross compilers. However, I would have to say that managed code has its place, unmanaged code has a purpose.

      --
      --- Justin Dearing http://www.justaprogrammer.net/ We're just programmers.
    169. Re:Trig functions... by Wavicle · · Score: 1

      Now that I think about it 1/(9!*7!*5!*3!) is a constant, so you could get away with doing one more multiply and no division at all. 11 multiplies and 4 adds for five terms of a taylor series isn't too bad. Since division is roughly 10 times the cost of multiply on a PPro/P2/P3 (39 vs 4 cycles) you might be able to come up with an intelligent algorithm for sin/cos using taylor series that is faster and more accurate than interpolation for all but an impractically large LUT.

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    170. Re:Trig functions... by Anonymous Coward · · Score: 0

      You are truely a moron. java.io is for synchronous IO. java.nio is for asynchronous and follows the BSD style non-blocking I/O API. Learn something about the topic before posting in the future.

    171. Re:Trig functions... by Aardpig · · Score: 1

      You make some good points; I'd overlooked the fact that the factorials can be precalculated. And yes, even with a LUT you are going to have to translate back into an interval of width 2*pi; either [-pi, pi], or [0,2*pi], or whatever. However:

      You shouldn't use just 5 terms anyway, writing out the equation for more terms seemed unnecessary.

      For sure; however, the further cost of any extra terms, above and beyond the 5 you've already given, makes a single Taylor's series expansion a poor approach compared to a LUT. One way of looking at a N-entry LUT is as N separate first-order Taylor's series expansions, each centered at a different point; I guess this is how LUTs win out, since with a large-enough N the accuracy of series, even at first order, wins out for intervals of width 2*pi/N. And hell, memory is so cheap nowadays that a N=1024-entry LUT is not a problem.

      Thanks for your thoughtful reply to my postl; you've just earned yourself a friend.

      Rich

      --
      Tubal-Cain smokes the white owl.
    172. Re:Trig functions... by Aardpig · · Score: 1

      Since division is roughly 10 times the cost of multiply on a PPro/P2/P3 (39 vs 4 cycles) you might be able to come up with an intelligent algorithm for sin/cos using taylor series that is faster and more accurate than interpolation for all but an impractically large LUT

      Ah, but interpolations in a uniformly-spaced LUT has no need of division; just 1 subtraction, 1 addition and 1 multiplication. And in a 1024-term table, the error caused by neglecting the x^3 and higher terms of a sin(x) expansion is of the order of 1e-8; i.e., down there with machine precision.

      However, I wonder whether something like a rational-function approximation could give a good approximation to sin(x)? Or a Pade approximation? Any thoughts? To be honest, a LUT is aesthetically unappealing to me; I'd love to have a really-fast algorithm in its stead.

      --
      Tubal-Cain smokes the white owl.
    173. Re:Trig functions... by Doomdark · · Score: 1

      Thanks, that's pretty interesting. Should make it much easier to use dbvis at work, since I'm remotely displaying it!

      --
      I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
    174. Re:Trig functions... by Anonymous Coward · · Score: 0

      If that is true then comparing GCC 3.3.x with M$'s compiler is nonsense as it does not use all of the trig functions but GCC 3.4 does, Also he should have added fortran 77 and fortran 95 and Objective-C. Also they should have added GCC 3.4 and GCC tree-ssa to that comparisions. For Java they should have also used GCJ.

    175. Re:Trig functions... by ajagci · · Score: 1

      Erm, did you read the article?

      Erm, did you read what I wrote?

      If you stay away from trig functions, your code should be as fast as VisualC++, and faster then code compiled with GCC. How is that not "high performance"?

      No, only code of the exact form used in that setl of carefully selected microbenchmarks is "as fast". Once you actually start using constructs like classes or multidimensional arrays, Java performance falls apart. Try implementing a complex number class in Java and compare its performance with a complex number class in C++.

    176. Re:Trig functions... by Wavicle · · Score: 1
      Hmmm... (scratching head) I should probably wait until I've slept on this some before going too in depth on this, and admittedly I'm not terribly experienced with interpolation, I've really only dealt with linear interpolation, but...

      Ah, but interpolations in a uniformly-spaced LUT has no need of division; just 1 subtraction, 1 addition and 1 multiplication. And in a 1024-term table, the error caused by neglecting the x^3 and higher terms of a sin(x) expansion is of the order of 1e-8; i.e., down there with machine precision.

      Wow, you can get an interpolated result for sin(x) in three arithmetic operations? Best chicken--scratch algorithm I can work in pencil and paper in this state of mind is 3 multiplies, 3 add/subtracts and one floor:
      inv_gap ::= 1/gap; // constant

      idx ::= floor(x * inv_gap)); // 1 multiply, 1 floor
      x0 ::= LUT[idx]
      x1 ::= LUT[idx+1]
      sin(x) ::= x0 + (x1-x0)*inv_gap*(x-x0) // 2 mults, 3 add/subs
      What am I missing? Coincidentally this shows another strength of using a LUT that I hadn't thought of. If x is not in the interval [0,2pi] it can be trivially fixed here with a bit shift on the variable idx instead of a divide, whereas a taylor expansion must perform a floating point mod (which in x86 assembly is weirdly implemented in the fprem instruction).
      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    177. Re:Trig functions... by ajagci · · Score: 1

      I contest this point, simply because the same could be said of C++. If C++ were built on top of an interpretive VM, you'd argue that C++ was a poor language?

      No. The problem isn't the implementation, it really is the language. C++ and C# both have been implemented on top of a VM (the CLR) and they don't share Java's limitations.

      There exist Java -> native machine compilers today that generate binary code similar to what a C++ compiler would do. Java->native compilers are much less sophisticated than the optimizing compilers of Intel or Sun, but are getting better.

      gcj is an excellent Java-to-native batch compiler. But it has the same limitations as JIT-based Java implementations. If anything, the JIT helps with avoiding some of the problems resulting from Java's language design.

      Would you accuse a C++ garbage collecting memory manager of being "not good in high performance computing"?

      Why would I? Garbage collection is generally more efficient than manual storage management. Java's problem isn't garbage collection, it's limtiations of the language itself. C# doesn't have those limitations, and neither does C++ (with or without garbage collection).

      The C++ designers were very careful to ensure that you could write a "complex" number class, a "string" class, and an "array" class that were as efficient as anything built into the C++ compiler. Try implementing those classes efficiently in Java and you'll see that you can't.

    178. Re:Trig functions... by Aardpig · · Score: 1

      Wow, you can get an interpolated result for sin(x) in three arithmetic operations? Best chicken--scratch algorithm I can work in pencil and paper in this state of mind is 3 multiplies, 3 add/subtracts and one floor

      Oops, I completely mis-wrote. I meant one addition, two subtractions and three multiplies. My standard code is this:

      inv_gap = 1./gap ! Constant

      w_a = (x0 - x)*gap ! 1 sub, 1 mult
      w_b = 1.-w_a ! 1 sub
      sin_x = LUT[idx]*w_a + LUT[idx+1]*w_b ! 1 add, 2 mults

      (please allow for my Fortran syntax!). Since for uniform spacing idx is calculated from a floor(), the operation count is identical to yours, and your algorithm is optimal too.

      Good point about the x shifting. Another aspect of the algorithm is this: if the interpolation is done as a sequence of monotonic x values, then the w_a calculation need only be performed if idx has changed. This gives an extra speedup (assuming that conditionals do not shaft the pipelineing).

      --
      Tubal-Cain smokes the white owl.
    179. Re:Trig functions... by mcbridematt · · Score: 1

      Keep in mind that the Windows JRE uses *cough*DirectDraw*cough* to render Swing widgets, which tends to make resizing Java Swing app windows a little faster on Win32, where applicable due to bad graphics card drivers etc.

      I find because of this, that intensive draw operations are faster on Windows. Of course, there is still issues with the JVM optimizatione etc.

    180. Re:Trig functions... by Anonymous Coward · · Score: 0

      Exactly. That's what I keep telling my dad about Cellphone reception and Laptop battery performance.

      Now, remember MIT's Haystack? A java all-in-one PDA/email/browser project that uses the latest GUI and XML technology, but requires 700MB of RAM to run. How many cycles till this fancy PDA makes it into OEM hardware bundling before anyone can use it in real time --it will run, but takes more than the OS to start up, because it runs on top of a JVM on top of our OS. There's something very odd about Java Virtual Machines: they allow you to run this from the *other* _slow_ VM: Virtual Memory. But it intrigues me that it is even possible for PDA software to need a machine w/ about 3 times faster than my 1.1Ghz and with 3 times more RAM. Haystack seems to run the same way as any experimental videogame emulators for the newest consoles.

    181. Re:Trig functions... by angel'o'sphere · · Score: 1

      You have never seen A SWT application (e.g. Eclipse) on Win NT or on a Mac?

      And you allways have never seen that a Swing application has usually the option to switch "look and feel"? It supports at least 3: Win, Java, Motiv.

      I'm working mostly with Java applications, Swing based. Non of them is slugish. Swing works very well since about 3 years. The myth that Swing is slow and sluggish keeps running, just like the myth that Java is slow and sluggish :-)

      Nearly all Java IDEs except JBuider and Eclipse are Swing based.

      SWT does not look native on all platforms, only on Win 2k probably, lol, and it is not FAST. SWT is as sluggish as AWT is. You just dont realize it because your computer is to new and to fast and you only have an SWT app and you never tried Swing on your new computer, because you KNOW that it is sluggish. And further, at least on Win NT, SWT is incredible UGLY.

      angel'o'sphere

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    182. Re:Trig functions... by bhavebaby · · Score: 1

      So your suggesting that only 20% of the world uses windows, and 80% uses alternative platforms (Linux, hp-ux, etc)? Are you serious? If you were a business, developing a software solution, and wanted to be profitable, where would your focus be? Think carefully about what your customer base uses. Think about the biggest computer manufacturers (you'll probably respond on one), dell, gateway, compaq. Do they offer a serious alternertive to windows? Nope. And why would a layout manager make ANY difference with the type of language that you use. If your talking about a right to left language, or top to bottom, that is a function of the textbox components that you use, nothing to do with layout managers. If your are painting the glyphs yourself, then you'll be using absolute positioning anyway.

    183. Re:Trig functions... by cloudmaster · · Score: 1

      [My understanding is that] It's not an issue of how long the program runs making everything gradually faster. It takes longer to initially set up with a JIT bytecode-native code step, so the performance gains (which are present as soon as the program start running) tend to offset the delayed startup time, and the delayed startup becomes insignificant after a suitable period of time. That's similar to how a perl program is initially kinda slow as the interpreter/compiler is loaded, but once the code is compiled, its performance is on-par with natively compiled code.

    184. Re:Trig functions... by Wavicle · · Score: 1

      Good point about the x shifting.

      I was tired and not thinking straight. idx ::= idx & 2^10 - 1 will do it, and faster than shifting.

      This morning I was thinking about this problem and remembered ages ago somebody mentioning something about "cordic lookup" or "cordic interpolation" or cordic-something. I think it works something like this:

      Imagine a unit circle, for any point on that circle the x/y coords map directly to cos/sin values. Now if we store 1024 x/y coords, we have a 1024 entry lookup table for cos/sin (ignoring for the time being that the cos/sin are just shifted images of one another). We have a circle approximated by 1024 points. Now imagine another table where we store 1024 x/y coords between the 1st and 2nd entries of the first table(0 and 2pi/1024 radians).

      We can use the first table to get a rough value for sin/cos and then use the second table together with a 2D rotation matrix to find the sin/cos as though we had 1024 entries between any of the two rough approximations. The rotation matrix costs, I think, 3 adds and 4 multiplies (where one add is 0 - sin(x), or was it 0-cos(x)?).

      This would effectively give us a LUT of 1 meg entries at a memory cost of 2K entries. I haven't thought about it carefully enough to figure out the actual operation count, but it would be fairly challenging to get similar accuracy from a taylor polynomial.

      If this method worked, we could extend it by adding one more 1024 entry LUT that contained the values between 0 and 2pi/1meg radians that would effectively give us a 1gig lookup table. As long as this didn't produce differences in values that were too small to be expressed in a float/double it should work.

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    185. Re:Trig functions... by ZeroZen · · Score: 1

      I would have to agree, i've done a couple java programming courses and found it very easy and *fun* to program with, basically because of it's use of objects for just about everything. Objects make the whole process of coding faster.

      C# Has alot of objects to use and as far as i can tell doesn't have alot of the startup overhead that java has. C# is meant to be platform independent, but it clearly is not.

      So if i was writing something for windows. I'd probably use C++. If i was writing something for linux, i'd use C++ (or c). If i wanted it to run seamlessly between both, i'd use Java.

      So what's the point of C# if we have VB? Not much, i still use it a little, just for the fun of it but not because i'm attempting to make anything serious or functional. Or portable!

    186. Re:Trig functions... by lsdino · · Score: 1

      C/C++ malloc routines can do the exact same thing as what you're describing.

      The real advantage Java (and .NET) has is it can move memory around, defragmenting it during the process, improving locality of reference, etc... But even that can be done in C/C++ with a compacting garbage collecting memory allocator & using handles to all of your memory.

    187. Re:Trig functions... by Doomdark · · Score: 1
      Yes, I read somewhere that 'native' graphics acceleration for JDKs 1.4+ is much more advanced on Windows (that is, there is such a thing). I think it may have even been mentioned in release notes... But even HotSpot used to be much faster (closer to "native speed") earlier. I hope this is not the case any more, that optimizers are on par on different x86/Sparc platforms (haven't done much testing recently on performance).

      Not that there's anything bad in Java being nicely optimized on Windows, but it sucks if/when same is not true on unix platforms (ie. "only" on Windows... apparently Apple has fortunately created a decent JVM for MacOSX from what I've heard). Esp. since Sun is finally getting serious about supporting Linux (their own distribution, selling multi-AMD-CPU [blade] servers).

      --
      I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
    188. Re:Trig functions... by kleinux · · Score: 1

      Not to flame, but I use Visual Studio 2003 on a Windows XP machine at work. It locks up hard at least once a week. It has been a blue screen on occasion, those are actually the more gentle lockups, as the system is trying to dump the memory to disk on those. Albeit, I am not sure what I would do with it anyway, so I just hit the power button and reboot. The typical lockup involves the mouse turning off and yellow lines going across the screen. Those look neat, because I feel like I just killed a TV when I see the lines :D

      I suppose to keep this from being a totaly offtopic post, lets talk about C#. As a language it is very nice, the problem with it is in the tools needed to use it. And by that I mean Visual Studio and source safe. Both cause me several hours a week of headaches. From the `I just hit F5 to run and components disapear from my form' to documents checking themself out for no reason and I am not even told about it. I am sure others out there who have used VS 2003 for desktop development can attest to these and others. Do note: I have had far fewer problems with C# when working on an ASP.NET app.

    189. Re:Trig functions... by catenos · · Score: 1

      If you've ever done much optimization work, you'd realize that most programs are speed limited by a few small, often simple loops that just happen to execute an expensive operation or just plain run a lot. So while micro-benchmarks are never perfect, these ones aren't too bad at reflecting what actually happens in real life programs.

      I wonder which kinds of programs you are writing (that is not meant as a rhetoric, but a serious question).

      What you describe doesn't reflect my experience (except for the simulations in physics I've done). Any program for "normal users" that I profiled hadn't such obvious points for improvement (except if the algorithm was buggy to begin with or for inputs that were corner cases - like CGI's that produce 30MB web pages which no normal user would want wait for that).

      --
      Keep an eye on which arguments are silently dropped in replies. Not always, but often times it's very telling.
    190. Re:Trig functions... by Matt2000 · · Score: 1


      We are achieving more, those programs they're talking about didn't exist for previous processors.

      Trading CPU cycles for development time is a valid choice. I for one would rather have more programs that run 20% slower, than fewer programs that run quicker.

      --

    191. Re:Trig functions... by Nurgled · · Score: 1

      640 programs should be enough for anybody!

    192. Re:Trig functions... by cylab · · Score: 1

      :) No, but the editor is it's best feature (in terms of code-completition, refactoring and code-navigation)

    193. Re:Trig functions... by gdchinacat · · Score: 1

      NIO != Non-blocking IO, it is New I/O -- http://java.sun.com/j2se/1.4.2/docs/guide/nio/

      The non-blocking features of NIO are only a portion. NIO also includes (http://java.sun.com/j2se/1.4.2/docs/api/java/nio/ package-summary.html):
      * Buffers, which are containers for data;
      * Charsets and their associated decoders and encoders, which translate between bytes and Unicode characters;
      * Channels of various types, which represent connections to entities capable of performing I/O operations; and
      * Selectors and selection keys, which together with selectable channels define a multiplexed, non-blocking I/O facility.

    194. Re:Trig functions... by kelnos · · Score: 1
      SWT does not look native on all platforms, only on Win 2k probably, lol, and it is not FAST.
      sorry, wrong, try again. swt on linux can use either motif or gtk. i suppose if you're a kde user neither is quite "native," but tough.
      SWT is as sluggish as AWT is. You just dont realize it because your computer is to new and to fast and you only have an SWT app and you never tried Swing on your new computer, because you KNOW that it is sluggish.
      once again, wrong. swt (on my machine at least) is _much_ faster than a comparable awt app (no, i haven't benchmarked, this is all anecdotal). as for swing vs. awt, i can't say, as i haven't used many swing apps. not because i "KNOW it is sluggish" and therefore won't try it, but because i haven't seen a swing app that i needed to use for anything.

      check your facts, dude. wild sensationalist accusations are a waste of everyone's time.
      --
      Xfce: Lighter than some, heavier than others. Just right.
    195. Re:Trig functions... by Paradise+Pete · · Score: 1
      If more people would use the SWT libraries (part of the Eclipse project) instead of the crappy AWT/Swing libraries

      I looked into this, and (being a mediocre programmer) tried to find "hold my hand" information on how to do it. What I found required too much learning effort on my part. I am looking forward to the Eclipse interface builder plug-in maturing. I'm hopeful that that will make the difference for me.

    196. Re:Trig functions... by Paradise+Pete · · Score: 1
      So your suggesting that only 20% of the world uses windows, and 80% uses alternative platforms (Linux, hp-ux, etc)? Are you serious?

      I don't think you understand the meaning of the word "and."

    197. Re:Trig functions... by q-the-impaler · · Score: 1

      ISS was found to have a leak in it, but I heard they were able to patch it up... oh, you said IIS. Let me rephrase: IIS was found to have a leak in it, but I heard they weren't able to patch it up...

      --
      Sierra Tango Foxtrot Uniform
    198. Re:Trig functions... by matfud · · Score: 1

      Yet another revision of my previous post.

      JDK1.4 is slower at trig then JDK1.3 because the 1.3 version did NOT comply with the JLS (Java Language Spec.) for sin and cosine. 1.3 was only accurate to around 5 decimal places for these methods while 1.4 is accurate to the full range of float (15-17 places) or double (huge number of places). x86 FPU's are not designed to handle this level of accuracy. Sparc hardware is significantly better.

      However, as I said in an earlier post, the Math class can now be optimised as a "low precision" "fast" version of StrictMath by implmentors that wish to do so.

    199. Re:Trig functions... by shemnon · · Score: 1

      as Paradise Pete said, do you understand the meaning of the word AND? Windows AND english only? You've got serious myopia if you think you can force english on all windows users.

      But as for the languages. What is the layout difference between Norwegian and Traditional Chineese? About 20 to 30 characters for some standard GUI labels. With absolute positioning you will have GOBS of white space in traditional chineese and your labels will overlap into the controls with Norwegian (or any northern european language for what it's worth). With absolute positioning you have to position for each and every language, a waste of efficiency.

      --
      --Shemnon
    200. Re:Trig functions... by Anonymous Coward · · Score: 0

      If layout managers worked like they were supposed to, then I would agree. But from my experience they don't. How many times have you been able to build an interface, change the label text from one language to the other, and have everything work out perfectly (especially with 20 to 30 character differences). No tweaking, no shifting things around, no padding to lower a control slightly because it's buried 6 panels deep and has a 4 pixel offset somehow? I'll bet that dragging the text boxes around using a drag and drop gui editor is just as efficient.

    201. Re:Trig functions... by Hast · · Score: 1

      I found one a href="http://www.robot.lth.se/videos/index.shtml"> short video of a robot balancing an inverted pendulum. However I can't seem to find the things about running Java on those robots. (There's a brief mention of it on the research page.) And it seems like that particular robot was programmed using a Java-to-C converter, although there was a realtime GC running. (Which is one of the harder realtime problems to solve with Java.)

      Unfortunately the texts where that is mentioned is in Swedish, and on another site. (www.cs.lth.se)

    202. Re:Trig functions... by buttahead · · Score: 1

      hey there cat... we argued before... hope it doesn't happen again... :)

      many programs for "noraml" users _are_ limited by tight loops. look to the wikipedia for info on big-o noataion.

      think about a VPN or router vendor that needs to route traffic for users. for each user, we must route each packet O(n).

      now think of a firewall vendor. we must route each packet after checking it against this set of deny or allow rules. this is a common case.. but represents an O(n^2).

      now O(n^2) can be "ok" for small n... and perhaps the "bugs" you talk about are poorly designed rule lookups. Now imagine a large ISP that uses a firewall to block virus' from being sent outbound. this is still O(n^2), but the n can be huge, and that loop is executed for each packet... also a huge number. hard to optimize. it usually takes a shift in philiosophy to break out of this kind of case. say, come up with a way that we don't have to check every deny/allow rule for each connection and you have beat it.

      oh.. and i'm drunk... so excuse the spelling... por favor.

    203. Re:Trig functions... by catenos · · Score: 1

      hey there cat... we argued before... hope it doesn't happen again... :) :-)

      many programs for "noraml" users _are_ limited by tight loops. look to the wikipedia for info on big-o noataion.

      think about a VPN or router vendor that needs to route traffic for users. for each user, we must route each packet O(n).

      now think of a firewall vendor. we must route each packet after checking it against this set of deny or allow rules. this is a common case.. but represents an O(n^2).


      Technically, that's O(n), too. If you double the number of packets to filter, you need twice the time, not four times. Same with the number of rules. So have it O(n) and O(m) (so to speak), depending on what you consider as primary input, but not O(n^2).

      now O(n^2) can be "ok" for small n... and perhaps the "bugs" you talk about are poorly designed rule lookups. Now imagine a large ISP that uses a firewall to block virus' from being sent outbound. this is still O(n^2), but the n can be huge, and that loop is executed for each packet... also a huge number. hard to optimize.

      That's why I spoke of programs for normal users, i.e. application programming. Yes, there are plenty of programs that are limited by a tight loop. But in my experience those are mostly found in special software (that has limited purposes), like, for example, routers.

      it usually takes a shift in philiosophy to break out of this kind of case. say, come up with a way that we don't have to check every deny/allow rule for each connection and you have beat it.

      Agreed.

      Just to make myself clear: I don't deny that there is plenty of room for optimization in lots of programs. But the stuff your average developer writes (i.e. user applications, web pages, etc.) makes only a small percentage of those programs (aka "when did you last write firewall or router software?"). So my point was, that the results of benchmarking tight loops is not too relevant with regard to the kind of software most of us write.

      --
      Keep an eye on which arguments are silently dropped in replies. Not always, but often times it's very telling.
  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.

    1. Re:Accurate? by Catskul · · Score: 1

      I think its pretty hard to separate the difference between the strength of the compiler and the strenght of the language. You could try with many compilers on the same language, but that still doesnt factor out maturity since the newer languages' compliers havent had the time to mature.

      --

      Im not here now... Im out KILLING pepperoni
    2. Re:Accurate? by Anonymous Coward · · Score: 0

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

      Of course, when you move out from your perl-world you'll realize that most languages are just specs. Different implementations yield different results.

    3. Re:Accurate? by DenOfEarth · · Score: 1

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

      Not to mention it also depends on the task at hand.

  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 subjectstorm · · Score: 1

      "Christopher W. Cowell-Shah's benchmarking code, available at:"

      http://www.cowell-shah.com/research/benchmark/code

      That's from Bacule's site (fails.org) referred to in the article synopsis. The vb benches are linked at the bottom if you want to check em out. Hope this helps.

      --
      ** Chigusaaa!!! You're the coolest girl in the WORLD!!! **
    3. Re:Why did VB do so bad on IO. by NetMasta10bt · · Score: 1

      Your fighting a loosing battle son. I know you spent all your hard earned money on your paper certificates. I know you think that they mean your smart.

      Companies don't care about these 'savings' even if they were true. Why? Because they want to get away from the Microsoft monopoly. They did it with their choice of the PC, and now they are doing it with the software that runs on them.

      Commodity, standards based software will be the winner in the end.

    4. Re:Why did VB do so bad on IO. by nberardi · · Score: 1

      By the way I am a C#/Java developer.

      >> Commodity, standards based software will be the winner in the end.
      So what you are telling me is that the EMCA is not longer a standards based organization? Hmmm... You might want to let the rest of the world in on that, because everybody has pretty much created the same JavaScript language support across all browsers and since that is no longer a standard we better go create a new scripting language for the web.

      You can't actually beleive anything you have just said. I can give you a crap load of fortune 500 companies that are switching to .Net. I can even give you a defense contract that is doing satilight signal processing in .Net. In cluding a "little" company called Novel that bought out a company so that they would have their .Net product that can be used on *nix OS's.

      Get a life and stop pushing your aging propoganda.

    5. Re:Why did VB do so bad on IO. by Anonymous Coward · · Score: 0
      Your fighting a loosing battle son. I know you spent all your hard earned money on your paper certificates. I know you think that they mean your smart.

      Please consider learning to spell before ridiculing other peoples' smarts...

    6. 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.

    7. Re:Why did VB do so bad on IO. by Boba001 · · Score: 1

      I'm guessing it did badly because the C# code used the Framework's StreamWriter/StreamReader (the correct way) while the VB code used the Microsoft.VisualBasic.* crap for I/O calls.

    8. 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.

    9. Re:Why did VB do so bad on IO. by tjensor · · Score: 1

      The IO code uses stuff found in the microsoft.visualbasic namespace, instead of stuff from the system.io namespace.

      In fact IMHO its not even good code for IO in VB6 terms, in that you could use Scripting Runtime to get much nicer file manipulation / IO.

      --
      <fnord>OBEY</fnord>
    10. Re:Why did VB do so bad on IO. by pr0c · · Score: 1

      "enkafan: 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: ..."

      I should have been a little more clear... My point was that they used old VB style instead of vb.net style so that it wouldn't be identical to c#.

    11. Re:Why did VB do so bad on IO. by DannyO152 · · Score: 1

      Does the Microsoft .net EULA(s) still forbid publicizing benchmarks results? (Don't flame if this changed -- it's not my platform so I'm not paying close attention.)

    12. Re:Why did VB do so bad on IO. by Anonymous Coward · · Score: 0

      So what you are telling me is that the EMCA is not longer a standards based organization?

      Fuck ECMA. The CLI is an ISO standard.

    13. Re:Why did VB do so bad on IO. by kleinux · · Score: 1

      Since C# is MS prized new language, it does compile to different, often better object code. Thus, C# winning does not surprise me. I do expect over time MS will optimize VB to match up better with C#.

    14. Re:Why did VB do so bad on IO. by nberardi · · Score: 1

      It was actually standarized by both ECMA as well as ISO.

  4. Wow by Catskul · · Score: 1

    Wow.... according to this gcc C sucks : (

    --

    Im not here now... Im out KILLING pepperoni
    1. 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

    2. 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"
    3. 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

    4. 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...
    5. Re:Wow by Anonymous Coward · · Score: 0

      I'm not so sure about that. Or the general value of the results shown at OSNews...

      Here's my results with the same code on Debian Sid with a 2.6.1-mm1 kernel, GCC 3.3.3-prerelease versus Sun Java 2 (1.4.2)

      Start C benchmark
      Int arithmetic elapsed time: 12320 ms with intMax of 1000000000
      i: 1000000001
      intResult: 1
      Double arithmetic elapsed time: 12560 ms with doubleMin 10000000000.000000, doubleMax 11000000000.000000
      i: 11000000000.000000
      doubleResult: 10011632717.388229

      Start Java benchmark
      Int arithmetic elapsed time: 18850 ms with max of 1000000000
      i: 1000000001
      intResult: 1
      Double arithmetic elapsed time: 104317 ms with min of 1.0E10, max of 1.1E10
      i: 1.1E10
      doubleResult: 1.00116327174955E10

    6. 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).

    7. 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.

    8. Re:Wow by dfeist · · Score: 1

      Not here:
      bash-2.05b$ /opt/intel/compiler70/ia32/bin/icc -O3 primzahl.c
      bash-2.05b$ time ./a.out

      real 0m0.004s
      user 0m0.004s
      sys 0m0.000s

      bash-2.05b$ gcc primzahl.c -march=athlon-xp -O3
      bash-2.05b$ time ./a.out

      real 0m0.003s
      user 0m0.003s
      sys 0m0.000s

      (Filtering prime numbers up to 1M)

      --
      Unix makes easy tasks hard and hard tasks possible. Windows makes easy tasks easy and hard tasks $29.95.
    9. Re:Wow by Anonymous Coward · · Score: 0

      GCC C does suck. In fact, I have seen cases where codewarrior is up to 25x faster at compiling and produces 7x faster code (in execution speed). Of course, GCC is free and runs on everything from the Itanium to a toaster. Oh well you get what you pay for I guess...

    10. Re:Wow by mirko · · Score: 1

      What do you mean ?
      Is it 20 times slower or 5% slower ???
      Is the difference that much in terms of technological update ?

      --
      Trolling using another account since 2005.
    11. Re:Wow by yamla · · Score: 1

      There were some small problems with that comparison though in general, it was a very well-written article. Even after fixing the problems, I'd still expect gcc to be lagging behind most of the other compilers as far as execution and perhaps code size. Anyway, I talked to the author of that article and he's writing another article due for early 2004, a further comparison.

      --

      Oceania has always been at war with Eastasia.
    12. Re:Wow by bradkittenbrink · · Score: 1

      Wow.... according to this gcc C sucks : (

      actually gcc on windows sucks, big suprise there

    13. Re:Wow by bar-agent · · Score: 1

      Apple added performance improvements to the version of gcc that they ship with Darwin. I wonder how much of a difference it makes?

      --
      i'd hit it so hard, if you pulled me out you'd be the king of britain [bash.org]
    14. Re:Wow by Anonymous Coward · · Score: 0

      The auto-vectorizing part is being changed (there is already a patch on a branch of GCC to fix this down fall).
      Also there is some talk about fixing FP problems on the x86 once and for all.
      Oh by the way stupid slashdot got rid of my saved password.

    15. Re:Wow by jpmorgan · · Score: 1

      gcc doesn't support all the language features. The major missing piece is the export keyword is completely unimplemented.

  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 mindriot · · Score: 1

      Actually, it's more of a surprise that Java performed /equally well/ in all benchmarks -- except the trig benchmark. The dismal performance in the trig benchmark is the second, much bigger surprise. It would be good to see the source code used to find out whether the code is BS or Java actually totally fails to produce efficient trig code.

    4. 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

    5. Re:Java Performing worse then C by jag164 · · Score: 1, Interesting
      Well, if you actually took the time to like at this submitters 'benchmark', it nothing but a poorly written microbenchmark. It provides no useful information what-so-ever.

      I code in a plethora of languages (mainly, python, c, c++, java) and trust me, execution speed is not an area I look at anymore when deciding on C or Java impl (unless , of course your dealing wih cross platform graphics) It hasn't been for 3 years.

      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.

      It think it may be time for you to crawl out from that rock you live under.

    6. Re:Java Performing worse then C by Seahawk · · Score: 1

      If speed is their only concern, then ask them why they dont use hand optimized assembler... :)

    7. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      Yah, like crap, complexity, and annoying code!

    8. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      > Java can perform as fast or faster than C code.

      Has anyone ever done benchmarks to prove that?

    9. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      Speed to develop the application or speed of processing.

      I have a dual athlon which is adequate for most java apps I develop.

      If I needed a large scale app ... Sun sell some really mean iron!

      C is a good language, but I'm not a good programmer!

    10. Re:Java Performing worse then C by pigscanfly.ca · · Score: 1

      Care to list some of those benefits?
      I here a lot of people talk about Java as cross platform .
      Unfortunitly Java as cross platform sucks , different JDKS fuck up different things and you have to write work arounds fairly often . Sort of like cross platform C eh?

    11. Re:Java Performing worse then C by Kingpin · · Score: 1


      What is it that you have problems running on different platforms? I have yet to see these fabled issues.

      The JDK doesn't fuck things up - it's a class library and a compiler and that's basically it. What work arounds? If they occur fairly often it shouldn't be too hard to supply an example?

      --
      Unable to read configuration file '/bigassraid/htdig//conf/14229.conf'
      Geocrawler error message.
    12. Re:Java Performing worse then C by abigor · · Score: 1

      I can't believe this was modded as a troll. Seriously, when writing real software, speed is only a concern in certain specialised areas. Good profiling tools can help to identify areas where optimisations need to be done in any code. More important are maintainability, speed of development, and freedom from thoughtless errors (buffer overflows and the like).

      The parent is entirely correct.

    13. Re:Java Performing worse then C by joib · · Score: 1

      While on the topic of disregarding execution speed, python allows _really_ fast development speed. Way faster than Java, for that matter.

    14. Re:Java Performing worse then C by puppetluva · · Score: 1

      The bad java 1.4.2 performance in trig is entirely due to the default trig functions in Java being StrictMath (much higher precision and better IEEE compliance than the other languages tested).

      One can turn off IEEE compliance in Java 1.4.2, do sloppy math (like the other languages do in this test) and Java will rank among the top performers there too.

      . . . therefore Java 1.4.2 is objectively as fast or faster than all other contenders. This has always been theoritically possible, and now it is true in practice.

      Java's problem is NOT speed, it is its lack of being free. Stop griping about the wrong thing so that we can keep pushing Sun to open it up further to the computing community.

    15. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      JAVA is Propriety, C# is ECMA controlled (MS just submit drafts like everybody else).

    16. Re:Java Performing worse then C by Just+Some+Guy · · Score: 1
      Because, 99.9% of the time, it'll be slower than the equivalent compiled C/Lisp/Fortran code. Why? Because very few people in the world can wrap their brains around ordering instructions in such a way as to keep those superscalar pipelines full, cache hits low, and branches predictable. Those that do understand this stuff are the ones writing optimizing compilers so that they don't have to do it by hand.

      I've written more than my share of 65xx, 680x0, x86, and MIPS assembly. I'm pretty good at it and my stuff always runs pretty well. Still, it would run several times slower on modern hardware than if I'd written it in C and let GCC do its magic.

      On a related note, why do so many people hold C as the ultimate speed language? It's not even close, but you'd think that it's a happy magic go-fast system to hear people talk about it.

      --
      Dewey, what part of this looks like authorities should be involved?
    17. 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

    18. 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++.

    19. Re:Java Performing worse then C by jwsd · · Score: 1

      All that matters to anti-Java zealots is speed.

      Memory usage is another very important issue.

      I am not anti any programming language. But Java does have its limitations just like every other programming language. It all depends on what the underlying application needs to deliver.

    20. Re:Java Performing worse then C by MosesJones · · Score: 1



      Umm strangely I've been developing large scale apps in Java, C, Ada, C++ and a few others for quite a long time.

      When ever performance was a problem in our large scale systems we did the following

      1) Buy more memory
      2) Buy more hardware

      THEN we'd worry about optimsation. If you are paying $10m for the software build who cares about a 30% increase in the $1m kit cost ? But a 10% increase because we start "optimising" would be noticed.

      Large scale systems have different problems, performance is in my experience rarely one of them.

      Unless of course your architecture is shit, then you are screwed no matter what the language is.

      --
      An Eye for an Eye will make the whole world blind - Gandhi
    21. Re:Java Performing worse then C by wurp · · Score: 1

      I hear that all the time, but Magicosm seems to run just fine on Windows, Solaris, and Linux. We do have some issues with it being sluggish on the Mac, but I suspect they'll be easy to fix.

      The only thing we do special to be cross platform is keep the paths case sensitive and avoid hard-coded absolute paths, which you should do anyway.

      We had never done anything with Solaris before the Game Developer's Convention of 2002, but when we got there the only issues were getting the latest version of java3d on the machine and dealing with its strange locale information. It took less than 5 hours to deal with both, and much of that time was spent waiting for the Sun people to bring us the new java3d version.

    22. Re:Java Performing worse then C by JohnnyCannuk · · Score: 1

      While I will agree that a jvm running a poorly written and optimized program will use quite a lot of memory, for most applications running in a production environment it isn't an issue - add more RAM.

      All this talk of hogging memory and I had a look at the memory usage on my box. Which application always takes up the most memory and/or CPU time when running normally? Netbeans 3.5? TogetherJ? DBVisualizer?

      Nope.

      Mozilla, hands down.

      And no java code to be found.

      --
      Never by hatred has hatred been appeased, only by kindness - the Buddha
    23. Re:Java Performing worse then C by bentcd · · Score: 1

      What is it that you have problems running on different platforms?

      The major headache tends to be the Swing API, which tends to be slightly buggy in subtly different ways in different versions of the SDK.

      A classical headache between platforms is the handling of modality in Windows vs handling of modality under X.
      --
      sigs are hazardous to your health
    24. Re:Java Performing worse then C by Anonymous Coward · · Score: 0
      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.
      I personally avoid java like the plague, but not for reasons of speed. For me, speed is much less relevant than the lack of complete Free Software implementations caused by the closed Java standards. All of the Java standards and source code have licenses so bad that if you get anywhere near them you can never work on any Free implementation again. Some of them even try to claim that any implementation of certain Java standards is automatically the property of Sun. Lack of speed can be counterbalanced by compelling language features, but lack of Free Software support cannot.
    25. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      While I will agree that a jvm running a poorly written and optimized program will use quite a lot of memory, for most applications running in a production environment it isn't an issue - add more RAM.

      Please... adding RAM is not an excuse. Put it this way. In a company I use to work for, they migrated a C++ program to a Java program. The C++ program maybe used 2 megs of memory. The Java used over 80megs. Not only that, but the CPU needs of the new Java application destroyed the Sun machine. Before Java, the thing ran like a dream... After Java it was a nightmare.

      The problem with adding ram is that my production environment cannot go down. If every feature brings the need for more ram and thus some sort of downtime... my boss and customers are not going to be happy. More RAM is not an option. I shouldn't need to 4 gigs of RAM to run java applications in a production environment.

    26. Re:Java Performing worse then C by bersl2 · · Score: 1

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

      If it can't be done in Logo, it's not worth doing!

    27. Re:Java Performing worse then C by aminorex · · Score: 1

      It's not a surprise, but your reasons are
      mistaken. Note that Java 1.4.2 performed
      on par with Visual C++ for everything execept
      trigonometric functions. The reason why its
      not surprising is that the JVM on Linux
      stinks. Use IBM's JVM for linux, Sun's for
      Windows.

      --
      -I like my women like I like my tea: green-
    28. Re:Java Performing worse then C by halosfan · · Score: 1
      Oh no... Speed is just part of the issue, and for me personally, far from the most important part. Check this, this, this and this for more reasons why some people still don't find Java an adequate language for their jobs.

      I currently make most of my living programming Java, yet I view it as either C++ for dummies or Python for suites, and either way, it doesn't match the original.

      --
      My only problem with Microsoft is the severity of bugs in their software.
    29. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      "Java Performing worse then C"

      It THAN, fuckhead! Jesus Christ I am so sick of seeing this. How the hell does someone graduate college when they can't even use the English language?

    30. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      All our production servers are running 4G RAM already. There are real life applications today that will go to 4G limit even in optimized, handcoded C++.

    31. Re:Java Performing worse then C by JohnnyCannuk · · Score: 1

      You don't need 4 Gigs. Sound like a bunch of C++ guys ported over to Java writing it like it was C++. I think you simply proved that you might need to know a thing or 2 about writing Java code before you do something like this.

      I have been writing Java since 1996 and I have never, even in the bad ole days of 1.0 or 1.14 jdk, seen THAT kind of RAM increase during a port.

      Don't blame your tools. Perhaps you should look at the architecture and coding practices of the system first before you go saying that it's Java
      's fault. I seem to be able to run java ok on my cell phone without issues.

      Oh yes, next time try signing in and giving more details if you want to be taken seriously.

      "I once worked on a C++ project" is not evidence of anything but FUD.

      --
      Never by hatred has hatred been appeased, only by kindness - the Buddha
    32. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      Please explain "porting over to Java writing it like it was C++." Precisely explain how explicit deconstruction leads to excessive memory use.

    33. Re:Java Performing worse then C by subVorkian · · Score: 1

      Well, if you actually took the time to like at this submitters 'benchmark', it nothing but a poorly written microbenchmark. It provides no useful information what-so-ever.

      So, how is it a poorly written benchnark?

    34. Re:Java Performing worse then C by matfud · · Score: 1

      By default java allocates itself 64Meg of heap. This is in addition to the amount of memory the JVM itself takes up. You can reduce this with command line options.

      Java is not C++. A number of conventions from C++ do not map well onto the java language. Some aspects of structs, for example, can be mimicked in java by using classes with publicly accessible members. However a class takes up a fair bit more memory then the equivelent struct. This is a major source of memory related problems when C/C++ programmers get their hands on java.

      matfud

    35. Re:Java Performing worse then C by the_greywolf · · Score: 1

      no offense to Java programmers, but this is exactly why i can't stand Java. it seems to encourage poor programming styles and practises. because of the garbage collection system, most people don't worry about the memory they use and let references go stale - the result is that a program that SHOULD use only about 10MB of RAM ends up eating over 200MB and continue growing. and then all these stale unused references keep getting skipped by the GC, forcing the VM to use the entire CPU scanning all 200MB looking for garbage to collect. speed isn't my only complaint - the GC and bad programming as a result is my other complaint. i like C becuase it forces the programmer to keep track of and clean up all his old pointers.

      --
      grey wolf
      LET FORTRAN DIE!
    36. Re:Java Performing worse then C by matfud · · Score: 1

      There are GPL'd JVM's
      here are some
      http://www.kaffe.org/links.shtml#freevms

      matfud

    37. Re:Java Performing worse then C by matfud · · Score: 1

      Why do you have a links to the STL and a discussion of "resource allocation is initialization." with stroustrop. What relevence do they have?

      matfud

    38. Re:Java Performing worse then C by matfud · · Score: 1

      Bad programming exists in all languages. Java does remove some of the pig pitfalls that poor programmers make.

      You have to let references go stale in Java. There is no way to deallocate an object.

    39. Re:Java Performing worse then C by halosfan · · Score: 1

      I was pointing out that, as a language, Java doesn't support a few constructs that make it significantly easier to develop and maintain software (and thus, run-time speed is not all that matters to "anti-Java zealots" as the parent states). Most of the STL concepts, especially when you look beyond containers, cannot be expressed as compactly and as elegantly with Java as they are with C++. Ditto for the RAII idiom.

      I personally don't care about Java being slow at run-time -- it is irrelevant to most of the problems I solve. I still often find Java lacking in other aspects.

      --
      My only problem with Microsoft is the severity of bugs in their software.
    40. Re:Java Performing worse then C by Anonymous Coward · · Score: 0
      It THAN, fuckhead!

      Nice grammar, shit for brains.

    41. Re:Java Performing worse then C by matfud · · Score: 1

      A lot of what is done using templates (the STL for example) is purely language preprocessing. There are a few preprocessors of this type available for java (and other languages that don't have meta programming as part of thier spec). Many people do use them to generate code. Actually a lot of the NIO code in jdk1.4 is created in this manner. There are also libraries for java that contain STL functionality (again often created using code generation techniques).
      (Im not talking about the changes that will be introduced in 1.5 as they are not comparable to templates).

      As for RAII, most java constructs obay these principles. A file is opened when you construct its FileReader/FileInputStream/RandomAccessFile. It can be closed manualy, however if you do not it will (should) be closed when it gets GC'd. There are some poorly designed classes in java that do not obay the principles but that is true of any language.

      matfud

    42. Re:Java Performing worse then C by texwtf · · Score: 0

      You forgot about massive bloat and overall brokenness, though those could be construed as implementation details, or perhaps features.

      There are, after all, java implementations that are small (not garbage collections.. err.. don't have garbage collection), as well as ones featuring multiple inheritance rather than the *SUCKY* "interface" thing, whereby _the programmer_ is forced to to loads of extra work because of deficiencies in the language. Tell me again why this is so much better than C++?

      There's also the fact that it still crashes my web browser nearly 10 years after its release upon the public. Oh, and every 0.01 rev of the language makes it necessary to have a different JRE to run different applets and/or applications.

      But yes, there is the speed issue. Why a language would be so low level in terms of its incredibly pedantic syntax and yet so slow to run boggles the mind. Look, the whole idea of using a crappy pedantic language is that it lets the computer RUN FAST. That's why assembly language still exists.

      No, I'm not a C/C++ freak, I'm a perl freak. Yeah, perl is a gross disgusting mess, and kinda slow too. But it's a *POWERFUL* language that makes my life easier. I _want_ the computer to think for me, and waste its cycles rather than mine. That's the point of a computer, right?

      Oh yeah, and java isn't cross platform, at least not nearly as cross platform as perl, python, tcl, etc. etc. etc. etc. etc. So what's the point again?

      Java applications are slow and bloated. Whoops, I mentioned speed again. Of course that's the fault of some sting or swing or awt or twat library and not the JRE or the application or Sun or you or me. I DON'T CARE. IT SUCKS ASS AND IT'S ALSO SLOW.
      My other apps don't suck ass and aren't slow and also don't chug down most of my system swap. Whoopty doo for your garbage collection. Did I mention the excessive bloat? Collect that garbage.

      Java is like the emacs of programming languages without the bonus of it having complex and theoretically useful functionality.

      Java would have rightfully died by now without the massive push by Sun.

      Whatever. I'm sure I'll get modded down as a troll by the java weenies, but it really and truly amazes me how much momentum such unfortunate "technology" has. Can't it just die an unpleasant death like WAP instead of lingering like COBOL?

      Ok, so there are two things in java that don't suck: Exceptions. Those are cool, or at least can be made cool if properly caught and processed. Also the type checking can be nice because the compiler will catch errors, though it's sort of a double sword because it makes programming brutal and byzantine. Hmm, guess that makes one thing cool. Well, I tried. Oh wait. Microsoft doesn't like it. There, that's two.

      PS. CLASSPATH sucks my nutsack. ARRGH!!!
      PPS. In C I say LD_LIBRARY_PATH=/opt/foo/lib and it will _look in all the libraries in the directory_ for what it needs. java requires every single jar file to be listed in the CLASSPATH. Oh and then the paths interfere with one another so each application has to set its own CLASSPATH. Back to shell programming we go.

      ARRGH! I hate Java!

    43. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      amen

    44. Re:Java Performing worse then C by halosfan · · Score: 1
      A lot of what is done using templates (the STL for example) is purely language preprocessing.

      Conceptually, yes, but then compiling is just a bunch of preprocessing steps. C++ template facility is fully aware of the rest of the language. Sure, you can implement it in a preprocessor, but such a preprocessor would have to understand its own target language syntax, thereby duplicating a large part of compiler's functionality.

      There are a few preprocessors of this type available for java (and other languages that don't have meta programming as part of thier spec). Many people do use them to generate code. Actually a lot of the NIO code in jdk1.4 is created in this manner. There are also libraries for java that contain STL functionality (again often created using code generation techniques).

      Interesting. I still expect them to either significantly lack in functionality compared to C++ templates, or accept a language that is very different from Java. That being said, I would still love to take a look at a Java preprocessor that is believed to be an adequate replacement for C++ templates.

      As for RAII, most java constructs obay these principles. A file is opened when you construct its FileReader/FileInputStream/RandomAccessFile. It can be closed manualy, however if you do not it will (should) be closed when it gets GC'd. There are some poorly designed classes in java that do not obay the principles but that is true of any language.

      Garbage collection is not deterministic -- that is, the language doesn't define when garbage collector is run. Which renders it largely useless for implementing RAII in a generic case. For memory (in most circumstances) you don't care whether a garbage collector is run now or a couple processor intructions later. For other resources, it makes a difference: think about releasing a mutex, for example...

      --
      My only problem with Microsoft is the severity of bugs in their software.
    45. Re:Java Performing worse then C by panoplos · · Score: 1

      And that is all fine and dandy until you start considering Java in the context of resource constrained systems (CPU, memory, etc.)... This is where C/C++ shines, and will continue to do so for a long time to come.
      In this arena, Java is often not even a viable option; and the solutions that do exist strip Java of most of those "benefits" you are alluding to.

    46. Re:Java Performing worse then C by jilles · · Score: 1

      This is true for an increasingly smaller amount of applications, mostly in the hard real-time/embedded domain. And even there Java is showing up with acceptable performance.

      The key thing is to know that you are making a tradeoff. Undenieably there are times when the overhead of managing a C project is to be preferred over the faster, less buggier development in a higher level language (not necessarily Java).

      --

      Jilles
    47. Re:Java Performing worse then C by Haeleth · · Score: 1

      therefore Java 1.4.2 is objectively as fast or faster than all other contenders. This has always been theoritically possible, and now it is true in practice.

      So Java supporters keep saying, and I'd like to believe it. And yet time after time people release benchmarks, like the ones linked in this article, which say different. If Java runs "objectively as fast or faster than all other contenders", where are the figures that prove this? Can you provide a benchmark that shows it, or maybe some source code in C and Java that shows the latter running faster?

    48. Re:Java Performing worse then C by JohnnyCannuk · · Score: 1

      Line for line porting of C++ to Java is a very common mistake C++ developers do (of which I was one back in the day). Because the syntax of the language is so similar, they end up changing the original program just enough to "become" Java, recompile and run. Then they wonder why it runs so slow, or slower than the original. Or they wonder why it take more memory (although 2 megs to 80 is a bit steep, even when you include the JVM). Often they write their own versions of various data structures, I/O routines, sort routines and the like instead of using the built-in, optimized routines provided by the Java platform because that's what they had to do in C++.

      Now, what should be done is a functional port to Java. That is, writing from scratch, create a Java program that reproduces the program functionality exactly. You could (and maybe should) do this without looking at the original C++ source.

      If that is what you mean by "explicit deconstruction", then more detail is needed. You simply cannot say "we ported a C++ to Java and it ran really slow. Therefore Java is slower than C++ and thus is a bad language" without explaining what the original program did, the kind of porting that was done, the quality of the code and the ability of the programmers that ported the code and when you did this alleged port.

      Did you by any chance run this code through a profiler to see WHY it was so slow and see where the bottle necks were? Did you do this in 2002 or 1997?

      Funny, I seem to remember the SAME arguments being levelled at C++ by the C zealots, with the same fallacies and FUD. Now, was any of that true of C++ then? Why should it be true of Java now, just because you say so with vague, specious evidence that can be explained in a hundred ways that have nothing to do with the Java platform?

      Of course the other question to ask is why do the port at all. Did you need access to Java's cross platform capabilities? Did you need access to some of the libraries? Did you need Java's vastly superior security model (which these days can outweigh speed and RAM considerably - a small fast program that can be hacked brough down by a buffer overflow is not much use is it)?Or were you sucked into the marketing hype? Right tool for the job. If Java is that tool use it. If it can be done with C/C++ or Java, use the language you are most comfortable in. Any other reason they you get what you deserve.

      --
      Never by hatred has hatred been appeased, only by kindness - the Buddha
    49. Re:Java Performing worse then C by matfud · · Score: 1

      A genral code generaion engine.
      http://www.jostraca.org/

      A generic template engine
      http://compilers.iecc.com/comparch/article /96-05-0 65
      (does not suport java but does support a number of other languages)

      Garbage collection is not deterministic (unless you run a VM with deterministic garbage collection). That is why many classes have a manual method to release thier resources. Similar to C++ objects on the heap

      matfud

    50. Re:Java Performing worse then C by kleinux · · Score: 1

      Vote QBasic for president in 2004!

    51. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      Java has completely and utterly destroyed COBOL, and has great success as a teaching language. Outside of those two niches, it has been substantially less successful.

      The fact that the former niche is huge doesn't justify the Java for every task crap you get so often these days from single-language Java programmers.

    52. Re:Java Performing worse then C by Anonymous Coward · · Score: 0

      Simple mathematic calculations in a simple for loop tests only math capabilities of the give compilation/VM. It gives no areas of string manip, object creation, mem management, thread swaping (context switching), in the java world it does not provide the VM to kick in the jit/hotspot, etc... It's weak like many benchmarks provided on /. I realize I'm feeding a troll, but if you had fucking clue to begin with you needn't ask this question. Now go away and play with your self b/c your sperm in a kleenex is better than you sperm in a woman propigating your idiocy to future generations.

    53. Re:Java Performing worse then C by j3110 · · Score: 1

      It'll be hard for you to find that case.

      1) Java FP works just fine on real hardware (not I32/I64 shortcuts of FP math). That means when you really need FP performance, you get hardware that supports FP properly, not a C hack that estimates 2/3. Honestly, intel chips in 80bit FP are probably only accurate to 64 anyhow. If you want an 80 bit accurate calculation done, you're going to have to rely on the same math libraries that Java does, and you'll have the same abysmal performance. Tell a bank that your C application could amount to a 1 cent difference in interest calculations every 1000 or so transactions, and I think you'll be kicked out with your software. Java does FP, and X86 hardware makes it very hard and slow to do. If you want to complain about FP performance, you should be complaining to Intel and AMD, not SUN.

      2) It's always been known that in most situations, the delta cost of the hardware required to run your software is generally much lower than development time differences for C and Java projects because you have to spend more time testing C programs for buffer overflows and memory leaks that just don't happen in Java. Once you slap a GC on C it performs like Java anyhow, then you have nothing to argue about.

      3) The fact that someone re-benchmarked and showed Java to be slower just shows me that most people benchmarking because they are skeptical of Java performance comparisons generally don't know enough about the Java platform to get performance out of it, whereas they have wasted years learning every -f flag on every C compiler. Performance tuning with Java is basically knowing which method/class/API to use in which situation. The basics of programming in any language, but I see plenty of people converting numbers to strings with 1+"" when they should use String.valueOf(1) or they use a String for a StringBuffer. There are classes in the standard API to do what you want, just use them properly.

      4) Their are other, possibly better ways of doing IO in Java as well (NIO) which make writting IO applications potentially faster in Java without having to implement a non-blocking IO system yourself. Most of the problems Java has had on Linux in the past have been IO based and have been related to poor threading support on Linux. The second benchmark was done on Kernel 2.6, which, AFAIK, the JVM hasn't been tuned to.

      There are a plenty of reasons to discredit the second benchmark as unfair to Java, but for most /.'ers, it's easier to discredit any claim that Java has decent performance because of the years of hard work they might have wasted optimizing, debugging, porting, and writting applications in C and telling everyone how much better C is than any other language. There are plenty of reasons to complain about Java, but general performance isn't really one of them, especially with people having 3Ghz processors when a 500Mhz would run every app they have just fine.

      --
      Karma Clown
    54. Re:Java Performing worse then C by finkployd · · Score: 1

      My main case is PKI. Java crypto functions run painfully slow. And when you scale that up it really starts to suck.

      Generally we use Power chips or Sparc64, so processor issues are not really a problem.

      There are plenty of reasons to complain about Java, but general performance isn't really one of them, especially with people having 3Ghz processors when a 500Mhz would run every app they have just fine.

      Very true, and I am all for Java applets, I think that is a really cool use of the technology to serve a need. Now servlets are a totally different story.... Suddenly that 3Ghz is not nearly enough to support a servlet that needs to scale to a large population and do things that Java is horrible at (like crypto).

      Finkployd

    55. Re:Java Performing worse then C by SnowZero · · Score: 1

      ...hard real-time/embedded domain...

      Realtime includes nearly all games, audio processing, video processing, operating systems, robotics. I think very few high-level language programs really replace something written in C/C++, but instead are just new applications that wouldn't have been written before. The percentage of C/C++ will go down, but I doubt the amount will.

      BTW if you want real language features *and* speed I suggest OCaml. Functional languages make almost everything else look like a toy, and really demonstrate the way generics, higher order functions, etc should be done. I'm not a big MS fan, but their forthcoming F# has promise.

    56. Re:Java Performing worse then C by SnowZero · · Score: 1

      Java3D, vs something like OpenGL.

    57. Re:Java Performing worse then C by SnowZero · · Score: 1

      Go find out for yourself at The Great Computer Language Shootout. Although now a bit dated, it covers *way* more than this OSNews aritcle. They even have a page where you can wieght the various benchmarks here.

      It's a real eye opener about supposedly "research" languages, and a great source of examples of how simple things are done in various languages. For me, in my work on Robotics/Vision/Graphics/Games, it told me what I already knew: C/C++ are the bomb (for what I do). If I ever start using a more featureful language, it will be OCaml (typcially, the feature sets of functional languages make the C/C++/Java and similar languages look like a joke. Only numerical speed saves C/C++, and only the vast libraries save Java.) The adjustable benchmark weights are great though, because they let you look at what *you* care about.

    58. Re:Java Performing worse then C by j3110 · · Score: 1

      You're an odd one. :)

      Have you ever written a site in C without CGI (CGI spawns new threads and is horribly slow)? Probably not. Java performs on par or better than most server-side technologies. If you are having a problem there, you probably should check out JRocket or the IBM VM and try Jetty to run your servlets if you are using Tomcat. If you're having a specific problem with crypto that is slow, it's probably a little bugginess in the implementation, and perhaps a different VM would fix it. If not, you can always wrap servlets in filters that handle the crypto for you in other languages and still leverage the ease of use of Struts, JSP, taglibs etc. that you get from Java Servlets.

      Still yet, if your project would perform 50% as well in Java, but you could save one week of development time on a team, you're more than justified in just setting up a load balancer and getting another box economically. If you have nothing else to be doing, that's a whole other story. I would rather spend my time worrying about being the best and through as much hardware as I can at the problem instead of throwing expensive development time at a performance problem.

      It's all in thinking of the greater economical good. Generally C is not the overall champion of the world. Assembler is always going to be faster than C if you know exactly how the processor works as well, but we don't all go around coding in assembler, mostly because it's not portable. The same arguement that was used in the creation of UNIX in general can now be used to support Java and similar languages. Portability, security, and proficiency were the issues. An OS written in C would run on any system with a C compiler. An OS written in C wouldn't need so much type checking and the compiler would catch a lot of errors. An OS written in C would take less time to write and update. At the time C was pretty slow compared to assembler too. History is repeating itself, and it doesn't take a rocket scientist to know which boat to get on.

      The chips you have should be great for FP in Java. The problem is, crypto doesn't need FP, just a fast integer unit. 64bit is even better! The problem may be that the Java crypto system you had didn't even try to use 64bit, and that would be a problem. Sadly, a 1.4 VM running on a P4 under windows is going to be the best performing Java system for your task. I don't much care for intel or windows because both make pretty inferior products in at least a few respects, but P4 hyperthreading and windows thread support coupled with SSE is probably going to be the best you can get out of Java. Your other alternatives, and I would prefer it to having a crashy server, are to pray that there is better 64bit support in the Java PKI algorithms that you are using (or try alternative libraries) or run a profiler and see what the hold up is and fix it yourself if you can. Java should not be noticably slower than anything else you are using even for crypto on the large scale. Play with it on various systems and I bet you can track the problem down pretty quickly to be something specific to your setup.

      --
      Karma Clown
    59. Re:Java Performing worse then C by the_greywolf · · Score: 1

      not even by changing the reference to null?

      --
      grey wolf
      LET FORTRAN DIE!
  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 Anonymous Coward · · Score: 0

      Eugenia didn't write this article. Of course you would have known had you RTFA or spent more than five seconds glancing at it before firing off a knee jerk troll.

    2. Re:Under Windows... by Anonymous Coward · · Score: 0
      I see once again that Eugenia
      I see once again that Eugenia is using her usual pseudonym of "Christopher W. Cowell-Shah".
    3. Re:Under Windows... by Anonymous Coward · · Score: 0

      I once again see a person who comments without reading the article. The benchmark (however crappy it may be) was not performed by Eugenia.

    4. Re:Under Windows... by Ianoo · · Score: 1

      Now that I have RTFA, I see that Eugenia herself didn't write it (I don't bother to look any more since OSNews seems to be a one-woman show most of the time), but my point about POSIX and the results under Windows stand. As an aside, I wonder how Mono would perform?

    5. Re:Under Windows... by be-fan · · Score: 1

      Eugenia didn't do the benchmarks, and she uses XP Pro mainly. But these where low-level numeric benchmarks. Except for the I/O one, they wouldn't have changed due to linking against different libraries.

      --
      A deep unwavering belief is a sure sign you're missing something...
    6. Re:Under Windows... by Anonymous Coward · · Score: 0

      Do not insult Eugenia, for she is a gorgeous geek babe!

    7. 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.

    8. Re:Under Windows... by millette · · Score: 1

      I was happy to see these results - it meant I didn't have to run the tests myself. At least it confirmed that gcc performs better in linux then its cygwin for, not surprisingly. Last question remains: what about mingw gcc?

    9. Re:Under Windows... by arvindn · · Score: 1
      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.

      If you'd clicked on the article, you'd have seen right at the top of the page

      "By Special Contributor Christopher W. Cowell-Shah - Posted on 2004-01-08 19:33:22"

    10. Re:Under Windows... by timeOday · · Score: 1
      I challenge anybody to produce any meaningful benchmark on any platform for which Python is fast. (I'm not just being rhetorical, please come forward if you have anything that even *might* fit that description.)

      In my experience the performance is closer to, say, a shell script than it is to C. That's OK for a a lot of things, especially since it's so easy to drop down to C/C++ for performance sensitive code.

    11. 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.
    12. Re:Under Windows... by Perl-Pusher · · Score: 1

      Yes, but to be fair the OS and the bench marking tools really need to be the same. I would like to know is what compiler optimizations are being used. That can make a big difference in your benchmarks.

    13. 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.

    14. Re:Under Windows... by scrytch · · Score: 1

      > I have a feeling that Python would perform a lot better if it was running in a proper POSIX environment

      If she used cygwin python, then she's dealing with gcc's performance, being that it's compiled with gcc, as well as cygwin's less than stellar performance. Python would certainly do a lot better if it were the native version -- just the overhead of calling "print" has to go through synthetic "syscalls" and cygwin's hack of a DLL-based-kernel.

      Actually, it doesn't look as if Eugenia even specified which build of python was used. I've come to expect this sort of thing from OSNews however .. what is it with the topdesk-ish links on that site incidentally? Did I get an adware virus or are those really there?

      However, I'm mostly just glad to see psyco get a mention. Psyco, stackless, and pypy are making me really excited about python, and it's nice to see a mention of one of those.

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    15. Re:Under Windows... by Anonymous Coward · · Score: 1, Informative

      py-Numeric should be used to do calculations in Python.

    16. 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
    17. Re:Under Windows... by mbbac · · Score: 1

      How are you supposed to benchmark various languages/compilers with Microsoft's Visual suite unless you benchmark on a Windows box?

      I'd like to see the Java 64-bit math benchmark run on a PowerMac G5. I hear that Apple's Java implementation is superior to Sun's in this arena. But, doing so would eliminate the Visual stuff from the group -- unless you used Rotor. *sigh*

      --

      mbbac

    18. Re:Under Windows... by Anonymous Coward · · Score: 0

      Eugenia has a sweet mouth, a "hungry" mouth.

    19. 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.

    20. Re:Under Windows... by Coryoth · · Score: 1

      Well, running python etc. under cygwin is rather like compiling and running VC++ code under wine really - so why not do that?

      Jedidiah.

    21. Re:Under Windows... by Anonymous Coward · · Score: 0

      hows your ass feel with your head up in it?

    22. Re:Under Windows... by Anonymous Coward · · Score: 0

      Nor can you properly compare GCC on Windows to MSVC on Windows. You should compare each compiler running on its "native" platform, otherwise you're just comparing the implementation of compatability libraries.

    23. Re:Under Windows... by Cobron · · Score: 1

      "g++ -O3 -march=athlon-xp -pipe -fomit-frame-pointer" ran 13 seconds (34 vs 47) faster under lin than under win with same parameters (gcc 3.3.2 vs mingw 3.2.3).
      I also didn't have that performance gap between csharp and gcc 3.2.3, only with running g++ without optimizations gave a comparable gap. CSharp with optimizations from the article was 1 second faster than gcc with optimizations. Csharp without optimizations was 1 sec faster than gcc with optimizations, both lagging ~ 10 secs behind their optimized brothers.
      I couldn't run the VS c++ benchmark ("/clr /GL" parameters incompatible... didn't find the fix), but I'll suppose the results are accurate.

      But why compiling under cygwin? I don't use the platform, but using mingw would've given the article a lot more credibility.

    24. Re:Under Windows... by Anonymous Coward · · Score: 0

      It is not Eugenia that did the tests. Your 4 insightful points once again prove the idiocy in slashdot.

    25. Re:Under Windows... by youBastrd · · Score: 1

      Actually, you can compare non-Windows applications with Windows applications. The benchmarks were for the number of seconds to get a task done, and "seconds" are compatible across architectures.

      Do each test in it's best case setting and compare the seconds to complete the test.

      --
      No one has ever fired for blaming Microsoft.
    26. Re:Under Windows... by haggar · · Score: 1

      How about the fact that the benchmark wasn't prepared by Eugenia but by a guy with a Windows laptop and no spare room for a Linux partition (you can read his comment in the OSNews thread).

      Mod parent as -1 "couldn't bother to check before criticizing".

      --
      Sigged!
    27. Re:Under Windows... by koali · · Score: 1

      Just a nitpick; you can do your "safer still" approach in Java using StringBuffer instead of String; and it will be much faster.

  7. Visual C++ runs faster on Windows. Duh by aardwolf204 · · Score: 1

    Visual C++ runs faster on Windows. Duh

    --
    Im dreaming ofa big bndwdth, That can resist the /.crowd.May ur days b merry & bright & may al
    1. Re:Visual C++ runs faster on Windows. Duh by bsharitt · · Score: 1

      Yeah, I've used GCC on Windows, and I'm not surprised that it didn't fare as well. It's defiantly not one of the best Windows compilers.

    2. Re:Visual C++ runs faster on Windows. Duh by mindriot · · Score: 1

      Hm, I don't really think that it has much to do with the fact that it runs on Windows. Except for maybe the I/O bound benchmarks, the others, couldn't be expected to gain much from being 'optimized for Windows'. And gcc was actually better on I/O. VC++ wins on the math benchmarks -- so MS may just have the better set of Intel optimizations.

      Besides, it would've been kinda difficult comparing the same set of compilers under native Linux, don't you think?

    3. Re:Visual C++ runs faster on Windows. Duh by j-b0y · · Score: 1

      Defiantly? You mean someone is trying to sabotage GCC performance on Win32? Is there no end to dirty tricks of those evil OSS programmers? :)

      --
      Please remain calm, there is no reason to pani... wait, where are you all going?
    4. Re:Visual C++ runs faster on Windows. Duh by aardwolf204 · · Score: 1

      Besides, it would've been kinda difficult comparing the same set of compilers under native Linux, don't you think?

      Wine anyone?

      *ducks*

      --
      Im dreaming ofa big bndwdth, That can resist the /.crowd.May ur days b merry & bright & may al
  8. Not that it would have helped by holzp · · Score: 1

    Not that it would have helped them survive the slashdotting, they run linux. Well, when they were up and running that is....

  9. Re:Quick! What's the difference between an apple a by Anonymous Coward · · Score: 0

    Serisously? Where is the joke? I didn't find anything funny in your post. I don't get the joke. Nice attempt though.

  10. .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).

    1. Re:.NET Languages and IL by narcolepticjim · · Score: 1

      It's possible to write C# code that will perform better than VB.NET code, as there are some differences in what the languages can do.

      VB.NET doesn't support unsigned integers, for instance. VB.NET supports late binding, which would perform much worse than C# in similar apps. Also, C# can use unmanaged code blocks, which could also provide better performance.

      Okay, I'm stretching, but there are ways in which C# would outperform VB.NET

    2. Re:.NET Languages and IL by enkafan · · Score: 1

      In addition to each producing IL, things like Function = ReturnValue, which some people have gotten worked up about, get optimized out by the jitter when it converts the IL to native code.

    3. Re:.NET Languages and IL by MBCook · · Score: 1

      That's mentioned. It was done in part to test the theory that they should all run nearly identicly, which was fount to be true for the most part. The tiny variations are probably due ot the different languages not producing the exact same IL code for the CLR. Things may have turned out the same, but if they didn't and the test wasn't run, we wouldn't have known.

      --
      Comment forecast: Bits of genius surrounded by a sea of mediocrity.
    4. Re:.NET Languages and IL by Zebra_X · · Score: 1

      C# supports late binding - it's more complicated to implement than VB.NET

    5. Re:.NET Languages and IL by Anonymous Coward · · Score: 0

      Why do any physics experiments? Surely we can work out the theory from first principles of philosophy and that will tell us everything we need to know. So cannonballs fly in straight lines, because the line is an imperfect object suitable for use on an earthly plane, and planets go round the Earth in circles because the circle is the most perfect shape, suitable for use in the heavens. No need to test that...

    6. Re:.NET Languages and IL by MS+Worm · · Score: 1

      Actually all the .Net languages can use unmanaged code through P/Invoke. C# can however create unsafe code while VB.Net can not.

    7. Re:.NET Languages and IL by ClubStew · · Score: 1

      Yes, I know that well, but the benchmarks seemed to be using only the base class library (BCL) which should have little to know effect on the benchmark results.

    8. Re:.NET Languages and IL by ClubStew · · Score: 1

      Right, but the benchmarks were only using the base class library (BCL) which should give little to no differences in the benchmark results. The compiler optimizations in this case are all that would matter, but from my own experience in using many of the different languages shows negligable differences.

      It all still comes down to the fact - barring unsafe code blocks (not unmanged, which MC++ can do, though) and P/Invoked functions with most (if not all, but I don't know ALL the languages targeting the CLR and if their compilers support everytihng) - each language is still bound to what the CTS provides.

    9. Re:.NET Languages and IL by ClubStew · · Score: 1

      I agree and realize this fact, but I still don't trust the massive difference in the IO test results. So long as they used the BCL (namely the System.IO classes), the results should've been close since, like I said before, the majority of the work is performed by the mscorlib.dll which won't run any differently from one language to the next (it's already compiled and the IL will be JIT'd and executed the same way).

  11. Which Java VMs were used? by csnydermvpsoft · · Score: 1, Redundant

    I can't get to the article because of the slashdotting, so can anybody tell me which Java VMs were used in this test? A friend of mine did a study for a supercomputing course in which he found that IBM's J9 Java VM significantly outperformed Sun's JVM.

    1. 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.

  12. String manipulation? by defunc · · Score: 1


    What about some string manipulation numbers?

    --
    .defuncrc
  13. 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
    1. Re:Would like to see... by iggymanz · · Score: 1

      naw, gcc usually loses to compilers totally optimised for one type of processor family. Gcc has to support 30+ processors, so first code made into intermediate form which then is used to generate code for specific processor. There's just no way gcc is going to be hotter than Intel's C compiler for x86, or MIPS*PRO C on MIPS, or Sun's C on Sparc, etc.

    2. Re:Would like to see... by IIEFreeMan · · Score: 1

      Actually using an intermediate language helps optimisation. The fact that gcc uses an intermediary language has nothing to do with the fact that it might be slower than some proprietary compilers on specific platforms.
      This just means that the backend for this platform or the frontend for this language is not as good as the proprietary version. This might be caused by software patents on some optimisation algorithm that are known to gcc developpers but can't be used :(.

    3. Re:Would like to see... by aminorex · · Score: 1

      According to this
      , GCC is faster than ICC for
      some purposes (like 64-bit arithematic).

      --
      -I like my women like I like my tea: green-
    4. Re:Would like to see... by CmdrTHAC0 · · Score: 1
      I didn't see any mention of the numerical results obtained being checked against what they ought to be (or even against each other).

      That last bit's pretty important. For me, Java and C produce 776627965 as the long result, whereas Python is giving me 10000000000. (And it's not some braindead failure like printing the wrong variable.) And Python came up with that result in -2940 seconds...

      --
      __CmdrTHAC0__
      In Soviet Russia, Spanish Inquisition doesn't expect YOU!!
  14. Meaningless by Anonymous Coward · · Score: 0

    This is a meaningless benchmark.

    In *realworld* applications, different aspects starts to matter, non of which these benchmark covers:

    1. IO speed
    2. Allocation/deallocation of large (potentially paged) memory segments. How does the language organize memory (wrt memory access pattern) so that cache-locality is maximized?
    3. Global optimization starts to matter bigtime
    4. Ability to use native features, such as IO completion ports, AEM on linux, etc, etc.
    5. bla, bla, bla.

    I have a lot experience with large system-level software and Java is sometimes too slow to be useful. For most business applications, however, Java is good enough.

  15. What about the version of Windows by Sonic+McTails · · Score: 1

    OSNews is showing the slashdot effect so I can't read the article, but I'm assuming that this was all tested on one version of Windows, like XP. In my personal experience, I found that some programs run faster in other versions, and I found the Java programs ran faster in Windows 98/ME then in XP, so I wonder if this was taken into account and if it wasn't, how much of a difference it would make.

    --
    This signature was left intentionally blank.
  16. Was the JVM tuned? by FerretFrottage · · Score: 1

    No question that C is faster than Java, but with a properly tuned JVM, I can get performance pretty close. The biggest penalty I saw was in startup. Besides the standard command line args, if you don't know what jvm.cfg check it out and learn how to use it.

    --
    "Look Lois, the two symbols of the Republican Party: an elephant, and a fat white guy who is threatened by change."
  17. 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 Anonymous Coward · · Score: 0

      I suppose you have heard of penguins!

    3. Re:Sitting on a Benchmark by Haeleth · · Score: 1

      Can you name any other development languages that only run on ONE OS, boys and girls? Neither can I.

      AppleScript?

    4. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0

      Idiot. Think before posting, please.

    5. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0
      I think your pompous assertion of no other languages working on only a single OS has now been proven a miserable failure. Should've taken an extra 30 seconds or so and actually THOUGHT before you posted.

      Moron.

    6. Re:Sitting on a Benchmark by nberardi · · Score: 1

      >> 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.

      Oh wait what about Mono? Boy there goes that question trying to spread FUD around?

      I can also name a couple what about COBOL when was the last time your wrote a COBOL program for Windows??

    7. Re:Sitting on a Benchmark by enkafan · · Score: 1

      I would also like to add that the componenets are not integrated into the OS any more than Java could be in C#. They just sit on top of Win32/WMI/COM+/etc.

      And saying C# components makes little sense. Next time the FUD is spread, try saying the .NET Framework is

    8. Re:Sitting on a Benchmark by Saeed+al-Sahaf · · Score: 1
      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.

      So what, and big deal. C# was built by Microsoft to run on Windows, and it's fast because it's integrated into Windows. Sounds like a good solution for Windows based applications. Quit strutting around with your ass in the air.

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    9. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0

      Fairness is out of the question, we don't want to be fair, we want to be realistic. One of the selling point of java it's the ability to run on multiple platforms, and there are lots of java development done on the windows platform. Compare the languages the way they are used in the real world.

    10. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0

      "Several components of C# are integrated right into the operating system"

      I always thought that the integer and floating point ops are integrated into the CPU? And these benchmarks are all about arithmetics. Go sell your fud elsewhere dude.

    11. Re:Sitting on a Benchmark by squiggleslash · · Score: 1

      Even if you don't take into account .GNU and Mono, C# has been ported by Microsoft themselves to FreeBSD.

      --
      You are not alone. This is not normal. None of this is normal.
    12. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0
      Actually I used to support a legacy app that was in COBOL which ran under Windoze. If you Google COBOL for Windows you will find dozens of compilers easily.

      Just keeping everyone in check...

    13. Re:Sitting on a Benchmark by steve.m · · Score: 1

      So you've not heard of the Mono c# compiler then ?

      That's the one written by Ximian, which runs on Linux and Windows (and probably a lot more platforms in the future).

    14. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0

      Clearly you have special needs so MicroFocus will give you Cobol on Windows
      (but that would make as much sense as using the .NET environment for Open Source developments).

    15. Re:Sitting on a Benchmark by Foofoobar · · Score: 1

      Sounds like an excuse to lock in developers.

      --
      This is my sig. There are many like it but this one is mine.
    16. Re:Sitting on a Benchmark by blane.bramble · · Score: 1

      I can also name a couple what about COBOL when was the last time your wrote a COBOL program for Windows??

      Let me see, COBOL... runs under VMS, DOS, Unix, Linux, and yes, there are even versions for Windows.

    17. Re:Sitting on a Benchmark by nberardi · · Score: 1

      okay I admit bad example. But that still doesn't negate the point of C# runs under linux using the Mono compiler.

    18. Re:Sitting on a Benchmark by Foofoobar · · Score: 1

      COBOL can run under windows. Just do a search on Google for Cobol and Windows.

      And MONO is only Beta.

      --
      This is my sig. There are many like it but this one is mine.
    19. 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.

    20. Re:Sitting on a Benchmark by valkraider · · Score: 1

      Applescript runs on several Operating Systems But the Operating Systems Applescript runs on only run on one brand of computer (processor/architecture).

    21. Re:Sitting on a Benchmark by Saeed+al-Sahaf · · Score: 1

      It is assumed that if you are building applications for Windows, you are "locked in", just as if you are building a PLATFORM SPACIFIC app for any other OS. Remember, the majority of desktops is still Windows, and so if you are building a app for Windows, you might just want to use some language that is optimised for Windows.

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    22. Re:Sitting on a Benchmark by a+hollow+voice · · Score: 1

      I can also name a couple what about COBOL when was the last time your wrote a COBOL program for Windows??

      Now that you mention it, it's a little disturbing how many people really do that.

    23. Re:Sitting on a Benchmark by FiskeBoller · · Score: 1

      Sure: Actor (Windows), Dolphin Smalltalk (Windows)

    24. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0

      COBOL is a supported language in the .NET framework.

    25. Re:Sitting on a Benchmark by Foofoobar · · Score: 1

      Not really. People have only shown a BETA version and Applescript which is a scripting language and not compiled. Being moronic would be assuming that that there is no truth in what is being said here and being forced to retaliate with 3rd grade school yard tactics as shown by a pre-grade school level intellect.

      You knuckle dragging tactics intrigue me but the fact remains that should your cromagnon shaped skull be able to fit more information that just the scratching of your genitalia into it's cramped space, you will realize that 90% of all development languages are cross platform.

      You'll realize this shortly after the paramedics arrive with the jaws of life to extract your head from your ass.

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

      Nope... alot of developers make their tools for multiple platforms. Here's the short list:

      Oracle, DB2, Apache, Real Media Player, Quake, Microsoft Office (works on Mac), Mozilla, Numerous mail servers, ftp servers, telnet servers, development tools, etc etc etc.

      There is a huge list. And do you know why? Because software companies want to make money. And providing their tools on many platforms increases their marketshare. So most software development companies are NOT going to build their software apps using a language that only works on one OS; they instead will uses development languages where their end result can be tweaked slightly to run on different platforms, rather than recoding their tools completely from scratch.

      For instance, let's say Oracle decided to build everything using C#. Once they were finished (since MONO is still in beta and not completely tested) they would more than likely recode everything in C++. Is this something they want to do? Hell no. So why not code in C++ from the start... that way all you have to do is tweak it a little for each OS.

      This is why .NET is failing so miserably.

      --
      This is my sig. There are many like it but this one is mine.
    27. 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!

    28. 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.

    29. 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

    30. Re:Sitting on a Benchmark by Foofoobar · · Score: 1

      Yeah it does... MONO is still only beta. Know of any software development companies who wants to develop applications in a language that is still beta on a platform? Not me.

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

      Mono is still Beta. I don't know of many developers that want to release apps using a tool that is still beta, do you?

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

      Smalltalk was used by banks on old Unix machines. Care to try again?

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

      Bzzzt. I said Dolphin Smalltalk.

      Yes, Smalltalk was used on a lot of platforms. But there are also very specific Smalltalk VMs that only run in single environments. Dolphin Smalltalk is one of those ... cool environment to code in, your code will only run on Windows.

      The same was ALMOST true for Digitalk, but they did produce Smalltalks for different enviroments. However, they didn't completely resolve cross-platform differences by the time the went out of business. There was even an effort to meld Visual Smalltalk with ParcPlace, but it too just kinda dried up.

      Smalltalk was not known for portability across vendors. ParcPlace and IBM were the most consistent across platforms. They also had the largest footprint.

    34. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0
      Most of what you originally posted is fallacy. C# as a development language is indeed cross platform. It's a fact that cannot be argued since many folks have already posted as such as proven you to be a fool.

      And your assertion of "no fair, because Microsoft's C# implementation is integrated directly into the OS" is likewise a fallacy. The code gets pulled into a CLR something like how Java bytecode gets pulled into a JVM. Perhaps .NET is tightly integrated with the OS but not C# is a development language.

      The fact that your original post is so full of faulty assertions shows how on the balls the typical moderators are. Sadly enough. What overshadows that is how wrong your statements were and how you can't see that.

    35. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0

      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?

      J#

    36. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0

      So .NET is failing miserably? Wondering what factual statistics for market data you are referring to when you make this statement. Where are you getting your information. Oh yeah, it's just an opinion pulled out of your ass. That's right.

    37. Re:Sitting on a Benchmark by FrostedWheat · · Score: 1

      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.

      Amiga BASIC?

      Wait ... that didn't even run properly on the Amiga.

    38. Re:Sitting on a Benchmark by Foofoobar · · Score: 1

      Bzzzt. It's still smalltalk. Just like SQL, each vendor may have their own specific versions with minor code changes but the code is generally the same; in ther words, you will not have to completely recode it to have it work on other platforms... you just have to tweak it a little. Just as you would any C++ program, Java program, Python, PHP, Perl, or any other program.

      There isn't a significant enough difference between the original smaltalk and this variant to qualify your answer and so while the INSTANCE of the code may not work on other machines, Smalltalk itself does and your code can be modified slightly in order to work on other machines without a revuild in another language.

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

      I don't know of many software developers that develop in something that is still beta, do you? MONO is beta still. Expected to be gold this year but is still beta.

      Also, since it is not supported by Microsoft or developed in conjunction, there is no guarantee that your code will work if changes are made to the codebase, the underlying API etc.

      After far as development languages go, it's close to cross platform but still has a ways to go. And even then, the jury is out until further testing.

      --
      This is my sig. There are many like it but this one is mine.
    40. Re:Sitting on a Benchmark by Anonymous Coward · · Score: 0

      Bzzt. You don't know anything about Dolphin Smalltalk.

    41. Re:Sitting on a Benchmark by FiskeBoller · · Score: 1

      Agreed. Nothing like SQL variants, which you might have a hope and a prayer of converting between two DBs. Try it sometime and you'll experience the difference first hand.

    42. Re:Sitting on a Benchmark by Foofoobar · · Score: 1

      Bzzt. You don't know anything. Heh.

      See? I can invalidate without providing facts or evidence too. And it makes me sound just as stupid as you.

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

      I do.

      Source Gear.

    44. Re:Sitting on a Benchmark by youBastrd · · Score: 1
      Several components of C# are integrated right into the operating system so naturally it's going to run faster on a windows machine
      You may be right... how about running these tests on Windows 98 then? Presumably, the OS won't be tampered with to run CLR. Instead the application will use DLLs only, so there's no native OS advantages.
      --
      No one has ever fired for blaming Microsoft.
    45. Re:Sitting on a Benchmark by Foofoobar · · Score: 1

      Heh. I have. I've been tempted to write a small script that makes rules to convert between one version of SQL and another to help with automated ODBC connections. :)

      --
      This is my sig. There are many like it but this one is mine.
    46. Re:Sitting on a Benchmark by FuzzyBad-Mofo · · Score: 1

      Besides Mono, C# support is available for MacOS.

      First I've heard of it. Details?

    47. Re:Sitting on a Benchmark by FiskeBoller · · Score: 1

      No no no. Topic at hand is Dolphin Smalltalk. Try converting that to a different platform and see if you're willing to make the same statement.

    48. Re:Sitting on a Benchmark by Otter · · Score: 1

      I don't have details but they shouldn't be hard to find -- Microsoft had an official release maybe 9 months ago of the C# environment for OS X. I believe they had initially promised to support Windows, Mac and FreeBSD but have never heard of anything released for BSD.

    49. Re:Sitting on a Benchmark by Foofoobar · · Score: 1

      You don't seem to get the clue yet so I'm going to do you a favor and do your thinking for you, ok? ALOT of languages have different flavors which are geared towards a certain product release (this is more common to scripting languages than compiled).

      But regardless of the minor changes, it is STILL the same language. Hence, it is cross platform. What you are trying to say is that because in London and Australia, they speak differently and have different sayings and phrases, that it is a different language than American english. That's some spurious logic there, spasmo.

      Aside from that, my wife works for a bank and deals with Smaltalk and yes, it does convert and it is easier than writing it all from scratch; it's a scripting language variant... of course it can convert to it's parent with a little tweaking.

      Now get a brain and get a life.

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

      Also F# ... only on MS Windows.

  18. cant compare Java and C by stonebeat.org · · Score: 1

    Java is intended to run on a Virtual Machine environment, and C is not.
    That is Java code can be run on any platform as long as it has a Java virtual machine. You can not do that with C++.
    you are comparing apples and oranges.

    1. Re:cant compare Java and C by nberardi · · Score: 1

      Actually the way that they compared them is totally valid. They took simular operations and ran time checks on them. And if what you are saying is true C would always be better because it is closer to the processor than the extra layer managed code adds on. But this shows some discrepency in that old logic.

      This is a totally valid test because they aren't testing anything that is deeper than runtime. A more biased test would have been to test memory usuage because C uses pointers and doesn't rely on a GC so it would always have lower memory usuage.

  19. According to this... by nberardi · · Score: 1

    According to this Visual C++ is faster than GCC? But what really surpised me was that a managed language was actually faster than a compiled language. Because look at Java 1.4 it kicked arss in all but a couple categories. Also what I don't understand is why VB.Net got such a high time for IO operations when all the .Net languages are compiling to the same IL. Also why didn't they try compiling VC++ into managed code too.

    I would really like to see the code they used for some of these tests because I am sure some of the operations can use some further optimization.

    But what really surprised me is that some of the managed code .net kicked butt over GCC.

    How can that be, everybody has been complaining about .Net for a while now about how slow it is, and how slow managed code is. Are there any other sources that do simular comparisons?

    I don't know how accurate this article is but I am glad to see .Net and Microsoft getting some high scores because it will be a good article to point some of my compiler geeks too. Because there modo so far has been GCC kicks arss even against VC++.

    1. Re:According to this... by Anonymous Coward · · Score: 0

      Dude,
      You on crack. I never heard anyone complain about how slow the clr makes things. Maybe your talking about java? There is the boxing issue if your dealing with lots of objects but any good developer can work around it.

      I've used c++, java, dot.net, an even old vb4-6 and I can tell you dot.net(c#) is usually faster and more efficent that any of them.

      I think MSFT sucks in a lot of ways but they have always had kick ass compilers & VMs. Hell the MSFT JVM is faster than the 1.4.2 java vm! Test it for youself if you don't believe me. We had to because we were replacing it(MSJVM) where we worked and we wanted to know what the speed impact would be with the Sun JVM 1.4.2.

    2. Re:According to this... by g_goblin · · Score: 0

      Also why didn't they try compiling VC++ into managed code too

      He did ... well sort of.

      In VC++ .NET, you can create a managed project or an unmanaged project. He created a managed project and then did a define telling the compiler to make the file unmanaged code.

      So what actually happens, the startup uses the CLR and then marshals the unmanged code execution causing a performance hit. This is what happens when you mix managed and unmanged C++ in the .NET world. The passing of variables from managed to unmanaged code has to be marshaled -- Ugh!!!!

      I did a test on this when I thought about upgrading to .NET. I didn't like the results and decided to stick with VC++ 6 but instead of using MS's implementation of the STL, I went with STLPort and have been much happier ever since with the performance.

  20. JRE compiled with? by Ruzty · · Score: 1

    One of the performance issues may be which C compiler the JRE was compiled with. I mean think about it, Java is only as good the the application that runs the compiled byte code you hand it.

    So, if the JRE was compiled without optimization flags for your CPU type then all java byte code you execute with that JRE is going to perform poorly.

    -Rusty

    --
    The Master (Angelo Rossitto) in Mad Max Beyond Thunderdome, "Not shit, energy!"
  21. 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.

    1. Re:this is just so bogus by Sanity · · Score: 1
      Benchmark code like this does not represent how these languages are used in practice
      In practice most people don't bother writing super-tight code because reducing development time is often much more important than runtime efficiency. Given unlimited time and developer resources, I could write super-tight Java code, avoiding OO completely, reusing objects left, right, and center to minimise or eliminate garbage collection, and avoiding threads. In parctice, few people have that luxury.
    2. Re:this is just so bogus by rpeppe · · Score: 1
      Given unlimited time and developer resources, I could [...] [avoid] OO completely

      No you couldn't: not if your spec was to fit in with existing OO code (and it often will be).

    3. Re:this is just so bogus by Sanity · · Score: 1
      No you couldn't
      Oh, why?
      not if your spec was to fit in with existing OO code (and it often will be).
      Well duh - which is why I didn't specify this constraint.
  22. Am I the only one? by gregarican · · Score: 1
    I don't see why it matters in terms of compilation speed. You could use lower level assembly or machine language and even get faster results. But I personally judge a language on its practicality, logic, structure, rules, portability, elegance, security, etc.

    All that being said :-| I think that Java in terms of building bytecode, client execution, and server execution is far behind the pack. Unless you have some multiple processor system with tons of bandwidth and memory it seems as if Java code is dog slow. Not trying to troll, just being honest. I can always pick out a website that delivering Java content by the number of times I keep on moving my mouse to ensure my system's still responding.

    1. Re:Am I the only one? by csnydermvpsoft · · Score: 1

      I can always pick out a website that delivering Java content by the number of times I keep on moving my mouse to ensure my system's still responding.

      Do you mean Java applets? They are the bane of anyone trying to promote Java as a good language. Most of that time that you're waiting is for your system to load the Java VM, which only has to happen once per program execution.

    2. Re:Am I the only one? by gregarican · · Score: 1
      You name it. Applet, servlet, whatever. I know the servlet part is reliant on the processing power of the app server. And I know there are other variables. Plus, as you mentioned, the initial JVM load takes awhile as a one-time process.

      But all that being said I still think that Java apps execute pretty slow. Not the most scientific statement I know, especially without specs or baseline. But just a statement.

    3. Re:Am I the only one? by Hast · · Score: 1

      Seems from the benchmark in the article that you are wrong. Unless you are doing a lot of trigonometry calculations on the WWW page.

      I bet it's just that the pages are overly dynamic and it keeps hitting the database all the time. They probably have the database on the same computer as well.

  23. 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 Anonymous Coward · · Score: 0

      Java may be 30-40% more productive than C++, but Python is 1000% more productive than Java.

      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?

      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.

    3. 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
    4. 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.-

    5. 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 ;)

    6. Re:They should benchmark development time by Delirium+Tremens · · Score: 1

      Stop fighting. The solutions for the two of you is jython.

    7. Re:They should benchmark development time by ultrabot · · Score: 1

      I don't know much about Python and I'll give it a go when I get a chance,

      Go ahead and try it today, there is not much of a learning curve. You will see that getting to know it is fun, not a chore like, say, Java.

      but it's really hard to take your comments seriously when you call Python a "Silver Bullet" in your sig ;)

      It has been a SB for me. Perhaps it would be more correct to say that OOP is a SB when realized by a language like Python (it definitely isn't w/ C++ and Java). And besides, little hyperbole never hurt anyone :-).

      --
      Save your wrists today - switch to Dvorak
    8. Re:They should benchmark development time by ultrabot · · Score: 1

      Stop fighting. The solutions for the two of you is jython.

      Indeed. Java is a friend of Python, C and C++ are friends of Python. Soon .NET will be a friend also.

      The only enemy is ignorance, but it is also the enemy of productivity, so Python is fighting the good fight :).

      --
      Save your wrists today - switch to Dvorak
    9. Re:They should benchmark development time by Sanity · · Score: 1
      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.
      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.
    10. Re:They should benchmark development time by primus_sucks · · Score: 1

      Personnaly I think Jython/Tapestry /Hibernate may be the ultimate web development platform, but I haven't used Zope much... I've witnessed that the Struts/EJB approach is not very productive.

    11. 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.

    12. Re:They should benchmark development time by joib · · Score: 1


      The only enemy is ignorance, but it is also the enemy of productivity, so Python is fighting the good fight :)


      Touche! ;-)

      And yes, I agree that python totally rocks. Waaah!!

    13. Re:They should benchmark development time by primus_sucks · · Score: 1

      BTW, thanks for your sig - it got me starting to look at Python. Now I'm starting to implement a major project with Jython, and I'm sure I'll be much more productive than with Java.

    14. 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
    15. Re:They should benchmark development time by jonabbey · · Score: 1

      Python may be more productive than Java for some programmers.. I don't know, I've not done enough Python (more than a few thousand lines) to be able to judge properly for myself. But I do know that my increase in productivity in moving to Java was closer to 10 times than it was to 0.3 to 0.4 times.

      I've written hundreds of thousands of lines of Java code without needing or wanting to use a debugger more than a handful of times. That's radically different from C and C++. When you add in the memory protection, solid encapsulation, threads and thread safe libraries, integrated exception handling, extensive class libraries.. the jump from C++ is really quite large.

      My (relatively uninformed) intuition is that the jump to Python isn't as large an improvement, but that's more about how really wretched C++ is, not about how ungood Python is.

    16. 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
    17. 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?

    18. Re:They should benchmark development time by DeKoNiNG · · Score: 1

      They should benchmark development time
      Java is just more easy to learn, but when you code as good in C++ as in JAVA, there should be no big difference in development time. But as said before, Java is more easy, thus from that point of view it has an shorter development time.

      --
      Troll: Large Giant, 63 hp, AC 16, Usually chaotic evil.
    19. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      You can always compare Corel Office for Windows and Corel Office for Java. Java version was developed quickly twice, and was dumped twice. First time the virtual machine got too old. -> rewrite... Another time was when the virtual machine got too old... Nope, they did not rewrite it third time.

    20. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      Longtime Java and C++ coder here. Development speed in these two languages depends on the task. Writing an app server that works w/ XML and databases? Yep - Java is much better for that because of the built-in libraries. I choose Java on the server every time.

      However, are you writing a GUI application? If so, Visual C++ (or Visual Anything) will beat the hell out of Java in development speed because of the damn layout managers that Java uses. Sure, sometimes the Java IDEs' gui-builder functions can give you something close to what you want, but more often than not you end up out in the weeds trying to figure out why the damned GridBagLayout has decided to make your cancel button stretch across the entire panel. Message to all Java programers: ADMIT THIS - YOU'VE BEEN THERE. Then follows the shame of replacing the layout manager with absolute coordinates (we call it "AbsoluteGridBag" - ha ha).

      And don't tell me it's me - over the years we've had contractor after contractor come in and perform Java GUI work. Some are truly excellent workers and can even create an (ugly) Java GUI almost as fast as a novice Visual Basic programmer can arrange a nice looking version of the same screen.

    21. Re:They should benchmark development time by starling · · Score: 1

      I'm pretty sure that the result would show the huge advanatage of Java over C++.

      Yeah - you can bill more hours of development work if you program in Java.

    22. Re:They should benchmark development time by gurustu · · Score: 1
      I realize that you were doing a little pro-Python trolling (the hyperbolic "1000%" and the inference that only "mediocre" developers would be more efficient with Java), but I would be interested in you had any references or evidence that backed your number up.

      All I can provide, unfortunately, is anecdotal evidence, and a little bit of theory. As a lead developer for a medium sized team of highly skilled developers, I find that many areas criticized by Python proponents actually contribute to a better development environment.

      For example, Java's static typing vs. Python's dynamic typing. While there is no question that many keystrokes are saved by Python's dynamic typing scheme, there is also no question for me that static typing makes it generally easier to understand and follow code that I'm reading (by providing more information up front), and eliminates certain classes of logic errors from code that simply won't show up from a straight compile. This simplifies code reviews, transitioning code from one developer to another, and gives code longer shelf-life.

      The same logic follows for Java's exception model (it certainly makes it easier to see when code is inappropriately swallowing an exception), and even for the general verbosity of the language as a whole. It makes it easier (again, the "for me" caveat should be assumed) to review the code of other developers, to follow that code, to transition that code.

      So that's some of my anecdotal evidence. Now here's my theory : when developing large and complex pieces of software, writing the code is the cheapest and simplest part of the process. Extra keystrokes (given how good most IDEs are) are unimportant. What's critical is how quickly other developers can understand, review, modify, debug, and/or replace your work. The more information your code provides to those developers, the more detailed that information is, the better. Yes, it's a nuisance to chain together all of the decorators to open a file to read (buffered) characters, but it's very clear to other devs exactly what you're doing. Clarity is my goal, and the language that provides the most clarity to other developers is that language that I will prefer. Right now, in a comparison of Python to Java, I believe that language to be Java.

    23. Re:They should benchmark development time by be-fan · · Score: 1

      A skilled Java programmer could write a typical piece of code just as quickly as a skilled python programmer
      --------
      Only if he wrote the code in Python :)

      --
      A deep unwavering belief is a sure sign you're missing something...
    24. Re:They should benchmark development time by primus_sucks · · Score: 1

      Well as a Java programmer learning Python and Jython, I don't think this is true. Just looking at a quick example from my "Jython for Java Programmers" book (p290), one program written in Java is 24 lines of code, and the Jython version is 16 lines of code. And I didn't even count the 5 lines of trailing } in the the Java version, so it could have been 31 lines!

    25. Re:They should benchmark development time by be-fan · · Score: 1

      Dynamic typing is really cool. It allows a much more "organic" way of developing software. You experiment for awhile to get a feel for the problem space, and churn out a prototype. Then, you can take the prototype directly to the production phase by gradually adding features, error checks, etc. Dynamic typing is especially sweet in a language like CL or Dylan, where you don't have to bother with types while developing, but can insert type declarations once the design has solidified, to enforce interfaces.

      All of this is helped out greatly by having the Python interpreter handy, where you can quickly develop and test new algorithms and get immediate feedback. We're talking test-driven design without the overhead of compiling and debugging tests. And debugging is a breeze, because the interpreter allows you to interactively manipulate the code. Its like a symbolic debugger, except you get the full power of the language while debugging.

      And that's before taking into account all of Python's nifty language features that Java doesn't have.

      Silver bullet? Hardly. But its a huge boost to your productivity!

      --
      A deep unwavering belief is a sure sign you're missing something...
    26. Re:They should benchmark development time by be-fan · · Score: 1

      Its even more productive 6 months down the road, because you realize that the language's dynamic nature allows you to extend the program without having to fuss much with the existing codebase.

      --
      A deep unwavering belief is a sure sign you're missing something...
    27. Re:They should benchmark development time by FiskeBoller · · Score: 1

      ROFLMAO ... and laughing all the way to the bank!

    28. Re:They should benchmark development time by ultrabot · · Score: 1

      but I would be interested in you had any references or evidence that backed your number up.

      There seems to be a concensus in the Python community about these numbers. I think it can be considered more or less valid because most of the py community knows Java, and feel the difference. Its the difference in thought process, there is less "mapping" going on from brain to the screen.

      there is also no question for me that static typing makes it generally easier to understand and follow code that I'm reading (by providing more information up front)

      This can be cirumvented by documentation, and generally having friendlier API.

      and eliminates certain classes of logic errors from code that simply won't show up from a straight compile.

      IME these logic errors are catched pretty well w/ runtime exceptions.

      This simplifies code reviews, transitioning code from one developer to another, and gives code longer shelf-life.

      Nothing helps there more than code readability. This includes the length of the code - you can easily digest only a certain amount of code at the time, and Python code is always shorter and thus easier to read.

      Extra keystrokes (given how good most IDEs are) are unimportant. What's critical is how quickly other developers can understand, review, modify, debug, and/or replace your work.

      I agree wholeheartedly. However, you miss an essential, "agile" angle in those extra keystrokes - w/ higher development speed you tend to experiment more and write more thorough test cases. Therefore you produce better code and cleaner architecture.

      Clarity is my goal, and the language that provides the most clarity to other developers is that language that I will prefer. Right now, in a comparison of Python to Java, I believe that language to be Java.

      I share your goals, and agree to disagree about the way of getting there. However, you don't have to make a strict decision to stick to Java and avoid Python. You can implement things like unit tests and prototypes in Jython, thus getting the best of all worlds. Jython won't have the performance of Java, but I'm sure you'll learn to appreciate the productivity boost you get.

      Perhaps you could implement your project in Jython over a weekend and then make your team implement it in Java :-).

      --
      Save your wrists today - switch to Dvorak
    29. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      "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."

      Oh, damn, and I write and maintain large projets all the time in Perl.

      I cannot say anything about Python, but Perl is equally good for large projects.

      Best wishes,

      Tels

    30. Re:They should benchmark development time by jwsd · · Score: 1

      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 differences between the two programming languages are not that big to give Java any meaningful lead over C++. C++ is harder to learn, hence a much smaller programmer base. But once you have mastered it, you can produce results at speeds on par with Java for many real life applications.
      The major difference is the libraries used by each programming language, not the languages themselves. Java has standard libraries for a lot of common tasks that all Java programmers use. But for C++ programmers need to learn different libraries even from the same vendor like Microsoft. Most C++ programmers tend to have their own common task libraries. Again if you have already mastered all necessary library APIs, the development time should be comparable for both programming languages for a lot of real life projects.

    31. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      No, Amazon runs mainly on C++.

      (Posting anon for obvious reasons.)

    32. Re:They should benchmark development time by cooldev · · Score: 1

      Can anybody point me to nontrivial production-quality Python application? Ideally a client side app that doesn't require a bunch of fiddling to get working. I don't much care what it is, but I believe I have the same bias as other Python skeptics in that it's good for writing small scripts and back-end stuff, but not for a high-quality app that has to work. I'd love to see a counterexample.

      For example, something like Chandler, but finished.

    33. Re:They should benchmark development time by ultrabot · · Score: 1

      BTW, thanks for your sig - it got me starting to look at Python.

      Thanks! That definitely made my day :-).

      --
      Save your wrists today - switch to Dvorak
    34. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      Hmm...As an empoyee of a company that makes millions of dollars per month off of a website run on over a million lines of perl code, I'll have to dispute that.

    35. Re:They should benchmark development time by TwistedSquare · · Score: 1

      What particular gains are there from dynamic typing? I looked it up and it looks interesting, but since my "productivity" goes down in weakly typed languages I'm not immediately convinced.

    36. Re:They should benchmark development time by be-fan · · Score: 1

      Let me tackle dynamic typing for a moment. If you think the point is to save typing, then you don't get it. The point is to let the computer worry about types, instead of the programmer. I can't count the number of times that, during the development process, I've had to propagate massive type changes throughout the program, because of a relatively simple change in the design.

      In Python, you only need to change code when semantics change, not types. This makes it very easy to adopt an evolutionary software model (which I find indispensable for *hard* problems) where you quickly develop a number of prototypes and see which desgn works the best. It also greatly aids in refactoring and extending the code, again because type changes to not need to be propogated.

      I'd argee, though, that Java is reasonable suitable for cases where you have a detailed design 100% spec-ed out before hand, but in many cases, your problem is simply so hard or so new, that you cannot do that.

      --
      A deep unwavering belief is a sure sign you're missing something...
    37. Re:They should benchmark development time by ultrabot · · Score: 1


      def f(obj):
      obj.quack()

      Call f with an object that can quack, and it quacks. No need to impose any class hierarchy, the only requirement is that the object can quack. After using DT for a while pieces just "click" and you immediately reach satori.

      Lisp and Smalltalk are other examples of DT. Weak typing is a different thing, Python imposes strong but dynamic typing. People at usenet are usually more than eager to explain the difference.

      --
      Save your wrists today - switch to Dvorak
    38. Re:They should benchmark development time by Sanity · · Score: 1
      Do you base this assertion to actual experience, or just a hunch that "it surely must be so"?
      I base it on actual experience, I used to swear by Python until I started using Java, now I would never consider writing anything non-trivial in Python.
      If both languages are used to solve the same problem, the Python program is much more concise.
      Even if this rediculously general statement were true, most development time is spent debugging code, not typing it in. If you follow your argument to its logical conclusion you should be using Perl, since Perl is much more concise than Python.
      Not to mention the difference in semantic complexity, which determines how fast you can churn out that code (assuming nonzero brain latency).
      Just because you find Java complicated doesn't mean a good programmer would.
      It's not physically possible to create the Java program as quickly, given the same typing speed.
      What a silly statement. The speed at which code can be physically typed into a keyboard is not the limiting factor for development time.
    39. Re:They should benchmark development time by PostItNote · · Score: 1

      http://sketch.sourceforge.net/

      Python is the extension language for Blender.

      Bittorrent is all in python.

      All of the things at http://www.pygame.org/ , some of which are big.

      Red Hat's installer.

      I guess the best example I gave you was Bittorrent.

    40. Re:They should benchmark development time by JSkills · · Score: 1
      Anonymous for obvious reasons? I'm not so bright sometimes, so please fill me in on why you had to post "amazon runs on C++" anonymously.

      Don't know where you got your info from, but here's where I got mine:

      MasonHQ.com

      Specifically, it says: 15 Aug 2003: Amazon.com powered by Mason Since mid-2002, Mason has been Amazon.com's official website templating system, powering the main Amazon.com site as well as partner sites. As one engineer at Amazon writes, "Mason elegantly solves the problem of large-scale web development, giving Amazon.com web developers the power of industry-standard Perl and the simplicity of re-usable components. This has made it easy to manage and evolve a very large mission-critical global codebase, and has halved the ramp-up time for new developers."

    41. Re:They should benchmark development time by Sanity · · Score: 1
      Call f with an object that can quack, and it quacks.
      And if you call f with an object that can't quack, do you find out at compile time or run time?

      Experienced software engineers quickly learn that any perceived benefit from weak typing is quickly lost in debugging. In general, it is better to find bugs at compile time than run time.

      It is for this reason that generics were one of the most demanded features for Java 1.5.

    42. Re:They should benchmark development time by criscooil · · Score: 0
      ...Python is 1000% more productive than Java.
      I've told you a million times, dont exagerate!
      --

      My life is an open book ... up to a point.

    43. Re:They should benchmark development time by ultrabot · · Score: 1

      And if you call f with an object that can't quack, do you find out at compile time or run time?

      Run time, it raises an exception.

      Experienced software engineers quickly learn that any perceived benefit from weak typing is quickly lost in debugging.

      Not true. These types of errors are rare, and catched immediately. There is no debugging involved, just look up the line in the exception traceback, and fix the error. "Experienced software engineer", having experience in languages that are not VB, C and Java, should know that.

      In general, it is better to find bugs at compile time than run time.

      Yes, it's slightly better. The difference is insignificant compared to the way static typing (as done in Java and C++) cripples your productivity. It's usually people who have not tried dynamically typed language that bring this up - it's an echo from the childhood trauma of having used Basic, and the relief brought by Pascal or C.

      --
      Save your wrists today - switch to Dvorak
    44. Re:They should benchmark development time by Maniakes · · Score: 1

      And if you call f with an object that can't quack, do you find out at compile time or run time?

      Compile time. That's what "Python imposes strong but dynamic typing" means. Every object has a type, but the compiler can figure it out for you based on what you ask the object to do. And if what you ask doesn't make sense, the compiler complains.

      --
      A legparnasom tele van angolnaval.
    45. Re:They should benchmark development time by Sanity · · Score: 1
      These types of errors are rare, and catched immediately.
      Only if you are writing relatively trivial code. In real software development you might be developing a component of a wider application, in which case you want the contract for your component to specify what types your functions take and return. Python doesn't have type contracts, this makes it unsuitable for serious Object Orientated programming.
      Yes, it's slightly better. The difference is insignificant compared to the way static typing (as done in Java and C++) cripples your productivity.
      It might cripple the productivity of a poor programmer, but type-safe programming is second nature to an experienced developer, and it gives invaluable compile-time guarantees about what your code will and won't do.
    46. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      I can't count the number of times that, during the development process, I've had to propagate massive type changes throughout the program, because of a relatively simple change in the design.

      Then your design wasn't so good, was it, moron?

    47. Re:They should benchmark development time by Prof.Phreak · · Score: 1

      Wow. Million lines of *Perl* code???

      --

      "If anything can go wrong, it will." - Murphy

    48. Re:They should benchmark development time by ultrabot · · Score: 1

      Python doesn't have type contracts, this makes it unsuitable for serious Object Orientated programming.

      Bzzt. You can typecheck and assert all you want. It is just adviced against, because you gain more by using truly dynamic typing. Some projects like Zope have implemented Interfaces system which do the same thing.

      It might cripple the productivity of a poor programmer,

      No, it cripples the productivity of any programmer. Experience is what you gain by doing stuff, "static typing = necessary" is what inexperienced programmers learn at school and reading beginner level books.

      but type-safe programming is second nature to an experienced developer, and it gives invaluable compile-time guarantees about what your code will and won't do.

      It's not so invaluable as you may think.

      You know, many Python (and Lisp, and Ruby) fans have C++/Java/whatever programming as a day job. They just know better, unlike most Java fans that have never done anything they weren't taught at school. Perhaps you shouldn't extrapolate your limited experience to what all "experienced programmers" should think. It's a bit inflammatory, too.

      --
      Save your wrists today - switch to Dvorak
    49. Re:They should benchmark development time by Sanity · · Score: 1
      Bzzt. You can typecheck and assert all you want.
      Bzzt. Run-time asserts are not the same as compile-time type checking and interface contracts. If you don't even understand this simple distinction then you really should avoid serious large-scale software development.
    50. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      I bet Intercal was the contender.

    51. Re:They should benchmark development time by ultrabot · · Score: 1

      Run-time asserts are not the same as compile-time type checking and interface contracts.

      Well, duh. Still, they can be used to enforce contracts.

      If you don't even understand this simple distinction then you really should avoid serious large-scale software development.

      It doesn't occur to you that I might know exactly where you are coming from, having been there myself some 4 years ago? I have just changed my view, because in life one learns new things.

      Can't you realize that I know something you don't, someone might say I have a wider perspective. I write large scale C++ for living, yet I "get" Python and dynamic typing. It's nothing you couldn't learn by playing with Python a little bit, perhaps even trying to create something bigger in it. I assume you are not inherently stupid and can learn new tricks.

      --
      Save your wrists today - switch to Dvorak
    52. Re:They should benchmark development time by uid8472 · · Score: 1

      ...static typing (as done in Java and C++) cripples your productivity.

      Fortunately, programming languages have advanced somewhat since then. In OCaml, if I declare let f x = x#quack (# being the method-call operator), then the type of f is inferred as < quack : 'a; .. > -> 'a, which is a function whose argument is an object that can quack and which returns whatever type the quack method returns. It is, of course, a type error to call f with an object that is not known to quack, and such code will not compile; yet, note the absence of any declared class or interface, or any other explicit type annotation, in the code.

    53. Re:They should benchmark development time by be-fan · · Score: 1

      It wasn't the *right* design. If you come up with the exact perfect design every time, then yay for you. If the specifications given to you at the beginning of the project are 100% complete, and your requirements don't ever change, than you can probably get away with static typing.

      99% of programmers will *not* come up with the perfect design the first time, certainly not when they are tackling a very difficult or new problems. Think about people in R&D fields. And unfortunately, in a fast-paced industry, requirements do change, and the design must be able to adapt. And in the long term, the design will certainly need to change to adapt changing requirements over the lifetime of the program.

      --
      A deep unwavering belief is a sure sign you're missing something...
    54. Re:They should benchmark development time by obergeist666 · · Score: 1

      Zope, a very flexible and easy-to-use application server.

    55. Re:They should benchmark development time by ultrabot · · Score: 1

      Fortunately, programming languages have advanced somewhat since then. In OCaml, i

      Yes, I know that static typing has better implementations than C++ and Java; at least Haskell and OCaml. Unfortunately almost nobody seems to use them. This is a shame especially for OCaml; I've played w/ it a little bit and kinda liked it, esp. w/ the knowledge that it will be almost as fast as C++ when compiled to native code.

      Type inference doesn't come w/o a price, though. OCaml is significantly harder to understand than Python, which is a factor. ISTR some OCaml people were even bragging how difficult their language is in some mailing list, in the childish 31137 manner.

      --
      Save your wrists today - switch to Dvorak
    56. Re:They should benchmark development time by gregfortune · · Score: 1

      No kidding! Do tell! That's, what, 25 or 30 million lines of equivelent C++? What in the world are you doing with a million lines of Perl?

    57. Re:They should benchmark development time by Anonymous Coward · · Score: 0


      Why has this been modded up so high ? It gives no information on why this would be the case ... It may BE the case, but why don't people SUPPORT their arguments ? I suppose because it can be modded to +5 interesting without any support at all ...

    58. Re:They should benchmark development time by primus_sucks · · Score: 1

      In general, it is better to find bugs at compile time than run time.

      True, but there is a third option - at unit testing time. If your code has a full suite of unit tests (which IMO it should no matter what language you're using) then I think it would negate the potential for run time errors caused by dynamic typing. I'm just starting to do a large project in Jython, so I guess I'll find out if this theory is true!

    59. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      Runtime checks can stop a program if they detect that a contract has been violated (and embarass you in front of the users), but they can't prevent starting a program that may violate contracts. They also aren't inherited per method.

    60. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      If changing a type takes you more than a keystroke or two in Java then you're a putz for having such a sucky development environment... any modern IDE should make class and method sig changes completely trivial. Eclipse, Idea... netbeans?

    61. Re:They should benchmark development time by ultrabot · · Score: 1

      Just because you find Java complicated doesn't mean a good programmer would.

      *yawn*

      Perhaps your Java-wielding friends might find the ad hominem attack appropriate, in Python community they are usually considered a sign of immaturity. Your attitude is a bigger problem in large scale programming projects than your language choice.

      What a silly statement. The speed at which code can be physically typed into a keyboard is not the limiting factor for development time

      You know, I could try explaining this to you forever, and apparently you still wouldn't get it. I'll leave it at that. Life's too short.

      --
      Save your wrists today - switch to Dvorak
    62. Re:They should benchmark development time by be-fan · · Score: 1

      Its not just a matter of changing class and method signatures. What about intermediate variables?

      --
      A deep unwavering belief is a sure sign you're missing something...
    63. Re:They should benchmark development time by Anonymous Coward · · Score: 0

      Because I work at Amazon and I don't want to get in trouble. Sure we use Mason and very good it is too, but the underpinnings are pure C++.

    64. Re:They should benchmark development time by aWalrus · · Score: 1

      You know, I could try explaining this to you forever, and apparently you still wouldn't get it. I'll leave it at that. Life's too short.

      Oh, please, by all means, do. I'm wondering how good programming can be equated to typing speed. It's a rather profound statement, really.

      --
      Overcaffeinated. Angry geeks.
    65. Re:They should benchmark development time by AArmadillo · · Score: 1

      You might want to take a look at topcoder. Their contests award points based on how quickly you submit the problems. Virtually all of the top coders (forgive the pun) use C/C++ as their primary language because the development time is so much faster. In fact, there was a discussion on their message boards a few months ago about it, and several people switched their primary language to C/C++ in order to remain competitive.

    66. Re:They should benchmark development time by Anonymous+Brave+Guy · · Score: 1
      C++ is harder to learn [than Java], hence a much smaller programmer base.

      You think there are more Java programmers in the world than C++ programmers? Really?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    67. Re:They should benchmark development time by jwsd · · Score: 1

      What I really meant were true C++/Java experts. It is easier to write robust code in Java than in C++, hence less people capable of writing high-quality code in C++. But there are true C++ experts who can natually write C++ code devoid of most typical C++ problems such as memory leak, memory corruption, etc. For them, the development time difference between C++ and Java for non-trivial projects are insignificant.

    68. 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.

    69. Re:They should benchmark development time by ultrabot · · Score: 1

      I'm wondering how good programming can be equated to typing speed.

      Of course it isn't. That was million miles away from my point. Apparently the rhetoric got lost, so here's the point:

      - Python let's you do the same thing with less typing

      - In Python you don't need to think as much what you are typing, hence there is shorter road from he brain to ready code, and you can type faster

      Therefore, Python code gets ready sooner than Java Code, and there is less code to maintain.

      --
      Save your wrists today - switch to Dvorak
    70. Re:They should benchmark development time by ultrabot · · Score: 1

      Runtime checks can stop a program if they detect that a contract has been violated (and embarass you in front of the users), but they can't prevent starting a program that may violate contracts.

      Testing (esp. Unit Testing) takes care of that.

      They also aren't inherited per method.

      In general such tests should only be put in the outmost interfaces. But I will reiterate that I don't really believe such tests are necessary, because calling a method with wrong argument type is pretty certain to raise an exception anyway.

      --
      Save your wrists today - switch to Dvorak
    71. Re:They should benchmark development time by ultrabot · · Score: 1

      You can't use true polymorphism.

      How come?

      You can't enforce inheritance.

      Yes you can, if you really want to.

      You can't code to an interface, or abstract class.

      Of course you can. Check out Zope's Interface, for example.

      You can't just look at a function definition and know what type of parameters it contains.

      You can write anything you want in the docstring. Nothing prevents you from writing:

      """ str,int,int -> int """

      These are all the things that will slow you down in six months, and beyond.

      What language did you use?

      --
      Save your wrists today - switch to Dvorak
    72. Re:They should benchmark development time by Anonymous Coward · · Score: 0
      Please create an array of one hundred random floats between 0 and 1. Here's the python:

      import random
      l = [random.random() for i in range(100)]

      str = "Please show my the java and explain how this sort of thing isn't a common no-brainer that is way faster to create and easier to debug and maintain than the equivalent Java"

      Now, I would like to tokenize the previous string on whitespace and make sure all words are in lowercase,

      l2 = [s.lower() for s in str.split()]

      Please show me the java. I know java at least as well as i know python, but i would never argue that I am anywhere near as productive in java as in python. python is more productive even for some things that i already know how to do in java but don't yet know in python (the interpreter and built-in documentation make the difference, and the language is higher level).

    73. Re:They should benchmark development time by Empyrean9 · · Score: 1

      You can't use true polymorphism.

      How come?


      Because all objects are created equal. The is no way of telling whether a particular class is really a descendent of the parent class the polymorphic expression was intended to act upon. This also ties in with my point about enforcing inheritance. When passing an object to a function there is no way to ensure that the instance is actually descended from the class the function was intended to handle.

      You can't code to an interface, or abstract class.

      Of course you can. Check out Zope's Interface, for example.


      I didn't say you couldn't create an interface, or that that you couldn't write code to implement an interface. Again, the issue is one of enforcement. There is nothing in Python to prevent someone from implementing only half of an interface and trying to use it. This difficulty becomes apparent when utilizing large frameworks with very specific extension points.

      In answer to your last question, I was using PHP at the time. I have not written code in Python; however, I will probably add it to my list of known languages eventually. I did do some research for these posts because I wanted to make sure the dynamic typing system works in a similar way to the one in PHP (my apologies if I missed anything).

    74. Re:They should benchmark development time by Anonymous+Brave+Guy · · Score: 1

      OK, I see your point.

      The sad thing is that the skills you attribute to "true C++ experts" -- avoiding memory leaks and such -- really aren't very difficult at all. It's just that reliable idioms for doing it have only become established over the past few years, and many people learn C++ from books whose authors haven't kept up to date, or lecturers who learned a decade ago and forgot that the software industry moves on a little in that time. There is absolutely no reason that C++ programmers shouldn't all learn a few basic skills from the start, and then not suffer the embarrassment of resource leaks, buffer over-runs and all the rest.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    75. Re:They should benchmark development time by Empyrean9 · · Score: 1

      I wanted to comment about your response to this criticism in my original post, but I had forgotten my initial intentions for mentioning it in the first place. I have since remembered them :)

      You can't just look at a function definition and know what type of parameters it contains.

      You can write anything you want in the docstring. Nothing prevents you from writing:

      """ str,int,int -> int """


      You can use your scheme of utilizing comments (docstring?) for indicating what types should be passed to a function, but not necessarily what types are passed to a function. The difference is subtle, but significant, and in certain situations can create bugs that are very difficult to trace. As a programmer if means that you have to faith that the code calling a particular function will not pass incompatible types. In a "type-safe" language, such as Java, you can be assured that the compiler will let the developer know before he/she passes "classA" to a function expecting "classB".

    76. Re:They should benchmark development time by ultrabot · · Score: 1

      The is no way of telling whether a particular class is really a descendent of the parent class the polymorphic expression was intended to act upon.

      The most derived version of a method gets always called, unless you explicitly request less derived version. Just as in Java.

      There is nothing in Python to prevent someone from implementing only half of an interface and trying to use it.

      Zope Interfaces can be used to enforce the implementation of all of the interface. That's why they were created.

      I usually just do

      class Interface: pass

      Because I don't really think enforcement is worth the trouble of dragging in the Zope Interface class to the project. In large projects it might be, esp. if a lot of the code will be produced by 3rd party developers.

      In answer to your last question, I was using PHP at the time.

      Well, that explains your prejudice. PHP is not generally known to scale w/ program size, Python is.

      --
      Save your wrists today - switch to Dvorak
    77. Re:They should benchmark development time by Empyrean9 · · Score: 1
      The most derived version of a method gets always called, unless you explicitly request less derived version. Just as in Java.

      I don't think you understood my point... In Java the compiler would check the following definition to ensure that all objects passed to myFunction are of type MyClass or descended from it:
      public void myFunction(MyClass parameter);
      In a dynamically typed language there can be no such assurances. The best that can be done is to manually implement checks, but this is tedious and time consuming. Additionally, these checks will only occur at runtime, thus complicating the process of debugging.

      Zope Interfaces can be used to enforce the implementation of all of the interface. That's why they were created.

      Again, Zope interfaces force the developer to spend their time implementing checks to make sure that instance objects fully implement the interface their methods were designed to handle.

      In the end, I suppose it is a matter of preference. Personally, I would rather place the burden of performing these tasks on the compiler.
    78. Re:They should benchmark development time by roju · · Score: 1
      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.

      If I was to compare Perl to any language, I'd pick Lisp or Smalltalk at this point.

    79. Re:They should benchmark development time by ultrabot · · Score: 1

      In Java the compiler would check the following definition to ensure that all objects passed to myFunction are of type MyClass or descended from it

      That's not Polymorphism, it's plain old static typing.

      In a dynamically typed language there can be no such assurances. The best that can be done is to manually implement checks, but this is tedious and time consuming.

      There is an assurance that the object has the methods that are called, because calling something that doesn't exist raises an exception.

      Additionally, these checks will only occur at runtime, thus complicating the process of debugging.

      They don't complicate debugging at all - you see the traceback on exception, and notice what line of code calls a method that doesn't exist. Such errors are trivial to correct, and are not really all that common either (usually typos).

      In the end, I suppose it is a matter of preference. Personally, I would rather place the burden of performing these tasks on the compiler.

      That's because usually these checks are not made at all in dynamically typed languages. They are simply not needed. It's a tradeoff, really. Dynamically typed languages lose some, and win a lot.

      Again, as your experience is with PHP, I would advise you to play around w/ Python a little bit and then reconsider these things. Believe me, I used to think the way you do now before discovering Python.

      --
      Save your wrists today - switch to Dvorak
    80. Re:They should benchmark development time by Empyrean9 · · Score: 1

      That's not Polymorphism, it's plain old static typing.

      It is highly related to polymorphism. Was my original criticism entirely lost on you? I said dynamic typed languages do not support "true" polymorphism, because - as you mentioned - any class can be valid with any expression provided it contains the requisite method! For instance, classes "ShapeA" and "ShapeB" could both contain the method area(), allowing for the seemingly proper execution of code, while failing to extend the anticipated "BaseShape".

      They don't complicate debugging at all - you see the traceback on exception, and notice what line of code calls a method that doesn't exist. Such errors are trivial to correct, and are not really all that common either (usually typos)

      In most cases I would agree with you, but only if you assume the developer writing code using the function:
      1. Has perfect documentation, and never forgets to implement a rarely used, but critical method; or
      2. Has the source code so the he can see how the function works so that he can make sure he hasn't forgotten to implement a method that is only called in certain circumstances; or
      3. Tests all possible input

      That's because usually these checks are not made at all in dynamically typed languages. They are simply not needed.

      Actually, in many cases these checks need to be made, especially within the scope of framework or toolkit development (of which I do a considerable amount).

      It's a tradeoff, really. Dynamically typed languages lose some, and win a lot.

      The gains decrease exponentially with the size, and complexity of the project.

      Believe me, I used to think the way you do now before discovering Python.

      Well I'll certainly give it a try. Please understand that I really have no prejudice when it comes to languages; they all have advantages, and disadvantages. What I'm attempting to do is make observations based around issues that dynamically typed languages have in common.

    81. Re:They should benchmark development time by Trejkaz · · Score: 1

      And in turn, the difference between Java and Python would be dwarfed by the difference between Ruby and Python...

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
    82. Re:They should benchmark development time by code_martial · · Score: 1

      I've written hundreds of thousands of lines of Java code without needing or wanting to use a debugger more than a handful of times.

      I've written just a few tens of thousands of lines of C++ code but without needing or wanting to use a debugger more than a handful of times. And all I had to do with the debugger was gdb exe core and a bt to see which function segfaulted. My increase in productivity and economy of LoC over C was about 10 times with usage of STL, std::string and C++ iostreams.

      Solid encapsulation? Probably if one gets a high playing around with pointers and unsafe type casting but then he/she should be responsible for the hangovers too.

      Extensive class libraries? Betcha there are more class libraries for C++ than for Java. What's not there is a java.sun.com to locate them in one place.

  24. Missed a test by eples · · Score: 1

    I think it would be nice to see string functions tested as well - some languages that are particularly poor with the Math are also particularly good with the Strings. IMHO

    --
    I'm a 2000 man.
  25. Bring out the Skeptical Hats... by ThosLives · · Score: 1
    Hrm. I read this article, and it's clear to me that this is not a comparison, per se, of language. There doesn't seem to be any mechanism for accounting for the compiler used. The article also does not seem to indicate such things as file size, time to compile, or that information, which is also part of the "performance" of a language. I'm not sure how you could come up with a benchmark that would do this in the first place. A good study would look at the various languages across different platforms and compilers, determine the variability of "time to perform function X" due to compiler / platform, and then compare against the differences in different languages to determine if there is a statistically significant difference. Right now we only have some partial data - we don't know how much is due to the language, the compiler, or some other unknown noise factors.

    These guys need to learn how to run designed experiments and provide useful data! This seems more like something to placate management...

    --
    "There are a dozen opinions on a matter until you know the truth. Then there is only one." - CS Lewis (paraprhase)
    1. Re:Bring out the Skeptical Hats... by nberardi · · Score: 1

      I have to agree with most things that you brought up because they are valid. But really with a test like this compile time doesn't matter, because programs only need to be compiled once. And if there is a comple seconds between compile time or a couple mintues that doens't really matter because if both programs get used for a year straight with out a recompile the minute or two extra that it takes is really null and void.

      Plus a compile time would just be a representive of the compiler used to compile the compiler and how much optimization the compiler might be doing.

  26. Sweet Lord by FortKnox · · Score: 0, Flamebait

    Visual C++ (an MS compiler/IDE) comes out on top.

    Java1.4.2 works as good as native code.

    Benchmarked on the Microsoft operating system!?!?!

    Lemmie go ahead and tell you the responses:
    They cheated on the benchmark!
    I ran my own benchmark and gcc rocked the casbah!
    Java is just slow starting and takes up too much memory.

    This article, itself, is flamebait.

    --
    Good quote, too many chars. Seriously, the slashdot 120 char limit sucks!
  27. Not really a proper comparison by 3lb4rt0 · · Score: 0

    either in the original XP based article or the Linux based comparison.

    Comparing fully compiled against JIT/interpreted code seems like a fools errand especially when some of the components test aren't native to the platform the test is run on.

  28. heres the link to the code by manifest37 · · Score: 2, Informative
  29. 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 steveit_is · · Score: 1

      I'm tired of all those coder-friendly excuses everyone keeps throwing around. End-User performance IS more important than code monkey development time (at least it should be for open source developers). The goals change ,however, if money is more important than user satisfaction then it becomes clear that execution speed doesn't matter beyond the initial purchase.

      If you consider the end result of a 1ms extra delay in performing a function times the (possibly) millions of users, times the number of times the function will be called in a year you will quickly realize that that 1 unimportant millisecond is costing alot of people alot more time than it would have taken the code monkey to just optimize the darn thing in the first place. Saying that modern CPU's are fast, and that 1Ms doesn't matter is just a cheap cop out to attempt and excuse your lazy coding practices.

    4. Re:What about coder's performance? by joggle · · Score: 1

      I know Lisp zealots claim to be able to generally develop apps the fastest. Performance is great as is compile time, but the syntax is so different from other languages that it takes a while to pick up.

    5. Re:What about coder's performance? by Anonymous Coward · · Score: 0

      Wrong bitchtard, you may have some minor argument for single applications, but these implementations self implode when scaled up on a system level. Advancements in processor technology cannot in any way, shape, or form keep pace with ineptitude. I can run 20 to 50 _real-time_ applications at 20Hz on a Cyrix686-166 with fvwm and gui monitoring & control. I have seen more than a minor number of instances where VB and java apps consume all available resources and still cannot efficiently get the job done. It is the developers, not the language, but the language permits a much higher level of incompetence. Ever seen a sun workstation crawl with 1Gb of memory while trying to search 100k records? How wonderful it is when garbage collection is done for you in java. - Geccie

    6. Re:What about coder's performance? by Deagol · · Score: 1
      Given the ever accelerating clockspeed of processors, is the raw performance of langauges that big an issue?

      You bet it is. I work for a high performance comptig center at a good-sized US university. While I don't support our various cluster machines directly, I interact with those that do (the admins and, sometimes, the users).

      On our Intel- and AMD-based clusters, the commercial compilers are often preferred to gcc (we provide both). While gcc's pure C performance is usually on par ("good enough" in some cases, where portability is a factor) to commmercial compilers, its FORTRAN speeds are regarded as pretty poor (especially on IRIX/MIPS). And since our users want to eek out every ounce of performance from their allocations, you can't blame them for using the best tool at their disposal.

      Still, gcc (the over-all project itself) never ceases to amaze me. It runs on more OSs than I even know exist, and in the absence of funds, it will get the job done for just about anybody (albiet a little slower sometimes).

    7. 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++.

    8. Re:What about coder's performance? by Anonymous Coward · · Score: 0

      Double the hardware speed is no excuse to let your code's executables get half as fast. The end user wants speed so he *can* use common things like vi while encoding DivX real-time or better, etc.

      Unscientifically I ran a MIPSpro compiled xmame on an R10K versus a slightly different version on gcc 3.2.x and saw 15-20% slowdown on gcc. Someone somewhere on the web claimed he had a gcc patch to allow R10K specific support and 15% speedup but this never made it into gcc.

    9. Re:What about coder's performance? by Hudjakov · · Score: 0

      You have'nt heard of seti program?

    10. Re:What about coder's performance? by CmdrTHAC0 · · Score: 1

      So if a 5-year-old CPU can handle any task, why do they keep building these supercomputer clusters like the Earth Simulator or the G5 cluster? Why do we have video cards if a CPU can do everything?

      The reason CPUs are fast enough to handle tasks we do today is that we're not throwing intensive problems at them. Imagine dispatching an AI to search your images by voice, then continuing a refreshing game of Final Fantasy Tactics on an emulator: the beefiest SMP box with multi-channel memory and RAID 10 would be screaming in pain.

      --
      __CmdrTHAC0__
      In Soviet Russia, Spanish Inquisition doesn't expect YOU!!
    11. Re:What about coder's performance? by stimpleton · · Score: 1

      "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."

      Raw performance will NOT always be an issue.

      Project cost to implementation phase often is an issue though.

      Remember, we are often at the mercy of stakeholders, and organisational politics In an ideal world, cost would not be an issue, but unless we are project developer, manager, and stakeholder then cost will almost always take a back seat to optimiztion and post implementation maintenance and development.

      I dunno, maybe the stakeholders of the projects I've been involved in were special, in that they are irrational, cost-driven, with the to-implentation cost reigning as king.
      Your stakeholders clearly are not like this.
      How I envy you.

      --

      In post Patriot Act America, the library books scan you.
    12. Re:What about coder's performance? by MSBob · · Score: 1
      "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."

      Only until such time that an average server can easily handle 6,000,000,000 concurrent users ;-)

      --
      Your pizza just the way you ought to have it.
    13. Re:What about coder's performance? by _fuzz_ · · Score: 1
      3. The XmlSerializer classes creates a special compiled executable specifically created to serialize objects into XML (byte code!!).

      Funny thing about that... I was working on a project using .NET web services when .NET was brand spankin' new. The performance sucked horribly. Finally we traced it down to IIS spinning off a bunch of compilers for every request. It was recompiling the XmlSerializer for our web service object on every single page hit. I'd be surprised if they haven't fixed this by now, but it seemed like a stupid thing to do in the first place.

      --
      47% of all statistics are made up on the spot.
    14. Re:What about coder's performance? by Trejkaz · · Score: 1

      Doesn't Java cover the first two points here?

      1. If Java regular expressions need to be compiled in the code, why would you assume it doesn't actually compile it down to executable code?

      2. There is an XSL compiler from Sun which compiles XSL to Java, which would then be compiled to bytecode, which is then executed. I don't see how this is any different either, and somebody may have already implemented an XSL compiler which uses BCEL to go directly to executable bytecode.

      Or perhaps you were just talking about .NET in general and not comparing performance with Java, as such, but more with say, Perl? Beats me.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
  30. 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.

    1. Re:Speed or accuracy? by theotherfish · · Score: 1

      I noticed that those papers are dated 1998 and 2000 - does anyone know whether the issues raised in them are still current? (in particular the math stuff)

      Someone else mentioned that the Intel floating point trigonometry instructions don't meet the JVM spec (so the trig stuff is done in software), which seems like a more likely explanation, given that that was the only area where Java 1.4.2 failed miserably.

      On a side note, both articles seemed to be written in a somewhat childish and excessively dramatic style (abrupt sentences, bold higlighting, lots of CAPS, etc.) - while skimming through them, I kept expecting to run into a 'So NYAH!' or two :)

    2. Re:Speed or accuracy? by g_lightyear · · Score: 1

      JAVAHurt, as referenced, is an article entitled "How java's Floating-Point Hurts Everyone Everywhere", and was presented in 1988. Many of the arguments it contains no longer applies - though not all. 1.5 has major improvements to java.lang.Math and java.lang.StrictMath that bring performance in line with libm, and correct rounding precision issues with BigDecimal. 1.5 includes static imports - meaning that you can import all of the static functions, allowing sin(x) instead of Math.sin(x) if you're a freak about that issue. 1.5 also improves a lot of the math capabilities. So while this kind of slating may be fuzzy feel-good, it's also one that's well on its way to being a solved problem, and in many of the arguments made, has already been corrected. Try reading up on the Java Grande tests that issues like his were meant to benchmark, address, and solve.

      --
      -- A mind is a terrible thing.
    3. Re:Speed or accuracy? by jafac · · Score: 1

      Then perhaps this comparison should also have included empirical measurements of comparative mathematical accuracy.

      --

      These are my friends, See how they glisten. See this one shine, how he smiles in the light.
    4. Re:Speed or accuracy? by derek_farn · · Score: 1

      The issue of how Java floating-point operations interact with the corresponding processor instructions is still an outstanding issue, see: http://gams.nist.gov/javanumerics/reports/jgfnwg-0 1.html It comes as a surprise to many that the IEEE standard for floating-point operations does not always require processors to resturn the same result for the same operation. But Java's "write once run anywhere" design philosophy does. The fact is that the designers of Java work(ed) for Sun and the Java floating-point model has a better fit to SPARC than to Intel x86.

    5. Re:Speed or accuracy? by joib · · Score: 1


      On a side note, both articles seemed to be written in a somewhat childish and excessively dramatic style (abrupt sentences, bold higlighting, lots of CAPS, etc.) - while skimming through them, I kept expecting to run into a 'So NYAH!' or two :)


      Umm, well, perhaps. Anyway, Kahan is the guy behind the IEEE 754 floating point standard, so you can rest assured that he knows what he's doing when he talks about issues in floating point computation.

    6. Re:Speed or accuracy? by aminorex · · Score: 1

      Those complaints are now obsolete.

      --
      -I like my women like I like my tea: green-
    7. Re:Speed or accuracy? by Anonymous Coward · · Score: 0

      "There ought to be limits on freedom." -GW Bush

      Yes, there ought to be. One should not have the freedom to carry nuclear devices on planes. One should not have the freedom to rape and murder children on playground.

      Your sig sucks. Wake up.

    8. Re:Speed or accuracy? by Anonymous Coward · · Score: 0

      How about, "There ought to be limits on your freedom to make fun of me."

    9. Re:Speed or accuracy? by chgros · · Score: 1

      and was presented in 1988
      By a psychic ? Check your posts, especially the parts in bold!

    10. Re:Speed or accuracy? by Anonymous Coward · · Score: 0

      Prof. Kahan has been for many years in the odd and perhaps unique position of being both a brilliant, insightful numerical analyst and something of a crank. His numerical ideas are brilliant; his ideas of how programmers and programming languages work (and should work) are less so.

      In all fairness, he's bedeviled by watching idiots making stupid mistakes over and over and over again. It does drive one buggy after a while.

    11. Re:Speed or accuracy? by Anonymous Coward · · Score: 0

      It's better to live on your feet than to die on your knees.

      Tyrants like Bush suck.
      But worse, are his followers. Sheep like you who beg for protection.

    12. Re:Speed or accuracy? by matfud · · Score: 1

      The performance of Java's Math library under 1.4 is a problem with suns implementation. As of jdk1.4 there are two Math classes for java. The highly accurate one (used to be called Math) has been renamed to StrictMath and the Math class has had its requirements reduced. This allows implementers to use faster less accurate implementations of the Math class. However Suns implementaion of the Math class directly calls the StrictMath class.

      matfud

    13. Re:Speed or accuracy? by g_lightyear · · Score: 1

      Congratulations, you've successfully missed a point. Question: Are you really of the opinion that the most important point, the one worth arguing with, was the date of publication? Or are you just saying you agree with the remaining, obviously non-controversial elements in that post.

      --
      -- A mind is a terrible thing.
    14. Re:Speed or accuracy? by shish · · Score: 1

      I don't even need to read the links to know that that prof is some anti-java zealot. why? because anyone who spells java in uppercase obviously doesn't know what they're on about :p

      --
      I mod down anyone who says "I will be modded down for this", regardless of the rest of their comment
    15. Re:Speed or accuracy? by Anonymous Coward · · Score: 0

      The complaints are not, in fact, obsolete. What Sun did was allow Java to be faster, but Kahan's complaints are about Java's lack of precision, rounding control, and inability to trap errors.

      Java provides no way to use Intel's extended precision 64-bit mantissa values, no way to trap important things like overflows, and no way to specify rounding mode. And there is no expectation of any of this to ever be fixed.

      aQazaQa

    16. Re:Speed or accuracy? by Trejkaz · · Score: 1

      Though the article is completely irrelevant now, it brings to mind a factlet which is the existence of the class java.lang.StrictMath. This is where you need to go to get strict trigonometric functions on Java, and it's quite interesting that this benchmark hit such low numbers on trig, when it was in fact using the faster trig!

      Maybe somehow Sun are inadvertently using StrictMath instead of Math.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
  31. 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.
    1. Re:Where is Fortran? by TeknoHog · · Score: 1
      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.

      Scalar performance aside, Fortran currently has a huge edge over C[++] with its array syntax. The language is designed with parallel processing in mind. Since modern processors have parallel instructions like MMX/SSE, this is a bonus even for uniprocessors systems.

      --
      Escher was the first MC and Giger invented the HR department.
  32. Alternative comparison, compiler shootout by SiW · · Score: 5, Informative

    Don't forget about the Win32 Compiler Shootout

    1. Re:Alternative comparison, compiler shootout by BiggerIsBetter · · Score: 1

      What about a Linux compiler shootout? There's more compilers out there than just gcc.

      --
      Forget thrust, drag, lift and weight. Airplanes fly because of money.
    2. Re:Alternative comparison, compiler shootout by Trejkaz · · Score: 1

      It's interesting that this one also omits the heralded king of performance, Intel C Compiler.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
  33. Java results no surprise by Shadowhawk · · Score: 1

    That's not surprising in either case, in terms of Java's results. It's well known that Sun has spent more time optimizing the Windows version of Java than any other, including the Solaris version.

    --
    My mind works like lightning. One brilliant flash and it is gone.
    1. Re:Java results no surprise by ajagci · · Score: 1

      The Java JIT should not have significant platform dependencies--these microbenchmarks should perform comparably on x86 Linux.

      Where Java performance sucks on Linux is in the GUI; there, Sun's tuning for Windows really does give Windows a leg up.

    2. Re:Java results no surprise by Juergen+Kreileder · · Score: 1
      That's not surprising in either case, in terms of Java's results. It's well known that Sun has spent more time optimizing the Windows version of Java than any other, including the Solaris version.
      That may be true in some areas (e.g. graphics) but it doesn't matter for these simple benchmarks. The code generators are the same on all platforms, ie. the Linux/x86 version will generate the same code as the Win/x86 version for these tests.

      Anyhow, these benchmarks are too simple to be meaningfull. (Also note: microbenchmarks are not really favorable to runtime mixed-mode compilers; Java has a different FP model than x86; he only tested the HotSpot Client VM not the more optimizing Server VM.)

  34. Re:Java is dying by csnydermvpsoft · · Score: 1

    Fact: Windows 98 is dying

    Hmm... someone needs to learn how to use search-and-replace better.<g>

  35. 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 velco · · Score: 0, Troll
      Writing the whole program in C or C++ is a premature optimization.

      Your comment strongly resembles premature ejaculation.

      ~velco
    2. Re:About the Python performance by costas · · Score: 1

      Yes, also the author left out the -O optimization, claiming that that it only optimizes for loading. That's absolutely true, so I hope he included compilation times in the benchmarks for C/C++/Java (he didn't).

      Comparing execution of a compiled, low-level language to syntax-checking/optimization/writing of bytecode to disk/execution of a dynamic languages is insane.

    3. Re:About the Python performance by Darren+Winsper · · Score: 1

      You could say the same is true of Java.

    4. Re:About the Python performance by MosesJones · · Score: 1


      And remember that writing and maintaining a system in multiple programming languages represents a significant over-head and increase in the total cost for that system. This is why organisations standardise on Java, performance isn't that important, its the cost of ownership that matters.

      And as with any performance test however all you have to do is wait 12 months or pay more for the hardware today.

      But then if Java is quick enough anyway... why worry ?

      --
      An Eye for an Eye will make the whole world blind - Gandhi
    5. 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.

    6. Re:About the Python performance by Anonymous Coward · · Score: 0
      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.
      ...and it's so obvious that you are concerned with optimization.
    7. Re:About the Python performance by ultrabot · · Score: 1

      ...and it's so obvious that you are concerned with optimization.

      Yes, I'm not denying it. The deal here is to avoid the proverbial premature optimization.

      --
      Save your wrists today - switch to Dvorak
    8. Re:About the Python performance by Anonymous Coward · · Score: 0
      The deal here is to avoid the proverbial premature optimization.


      I find an effective approach is to stop for a bit and think about baseball, nuns... you know, something to slow yourself down a little bit.
    9. Re:About the Python performance by Cuthalion · · Score: 1
      Also about C!
      Oh wait...
      --
      Trees can't go dancing
      So do them a big favor
      Pretend dancing stinks!
    10. Re:About the Python performance by goodviking · · Score: 1

      SWIG can be useful also.

    11. Re:About the Python performance by Anonymous Coward · · Score: 0

      But the code has start and stop timers, and outputs the time taken for the code between two points to execute, so loading/byte-compiling/whatever time shouldn't have had any impact on the execution.

  36. Subset by tedgyz · · Score: 1

    I think this is a pretty good analysis. The very fact that it is non-partisan is a blessing. As a Java web app developer, I notice that if I take a subset of the graph for int and I/O operations, Java is quite competitive (#1 for the sum of those two metrics) with the other platforms. The trig stuff seems to really skew the results.

    --
    "No matter where you go, there you are." -- Buckaroo Banzai
  37. 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.

    1. Re:What about development ease... by Da+VinMan · · Score: 1

      Amen! This reasoning is why I've recommended and/or used Python, C++, Java, VB, and VB.NET on projects. You can be a one trick pony if you would like, but it's not necessary and it doesn't serve your clients/employer in the best way possible.

      --
      Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!
  38. optimizations ? by Anonymous Coward · · Score: 0

    gcc -march=pentium4 -msse2 -mfpmath=sse -O3 -s -mno-cygwin

    no loop unrolling ???
    no inline functions ???

    In fairness, gcc is not the world's greatest
    optimizing compiler. It is the world's
    most portable compiler. That code he
    compiled for cygwin can uploaded to a
    15 year old VAX and compiled and run ...
    or to a beowulf cluster.

    Try that with VB.

    1. Re:optimizations ? by Anonymous Coward · · Score: 0

      He missed a lot of optimizations.

      I was able to get pretty close to his numbers on a 1GHz system.

  39. My benchmark of six languages by Anonymous Coward · · Score: 0

    1. Bulgarian
    2. Russian
    3. English
    4. Korean
    5. Japanese
    6. Chinese

  40. Java on Windows and Linux by little_id · · Score: 1

    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.

    From my experience Windows has always had the edge on the Java VM. But this could all be coming to a change:
    Red Hat Linux 9 and Java 2 Platform, Standard Edition 1.4.2: A Winning Combination

    A quote from the article states
    "Internal tests reveal that performance of NPTL with a client/server application has been impressive. On a 2 X 1.6 Ghz P4 Xeon system, time to completion was 191% faster with J2SE 1.4.2 running on NPTL, compared with J2SE 1.41 running on the original Linux threads."

  41. Their server is getting a good test right now by Anonymous Coward · · Score: 1, Funny

    They should have picked the fastest language for their server.

  42. 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...
    1. Re:Read the OSNews thread by avandesande · · Score: 1

      Not to mention creating a math intensive java app is almost completely unheard of. A benchmark that throws alot of text around would be much more interesting.

      --
      love is just extroverted narcissism
    2. Re:Read the OSNews thread by Anonymous Coward · · Score: 0


      Good point.

      These small code snippets are ideal for demonstrating Microsoft's excellent JIT technology. Hats off to Microsoft for this.

      But what about the apps that Microsoft sells? They are mostly unmanaged code versions that go under extensive optimization processing before shipping in order to gain performance levels that no time/spce constrained JIT process could match.

    3. Re:Read the OSNews thread by javajedi · · Score: 1

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

      I think you mean for a Hotspot compiler.

    4. Re:Read the OSNews thread by be-fan · · Score: 1

      Hotspot is the name of Sun's JIT compiler. Just in Time compilation (JIT) is the technology, Hotspot is the brand name.

      --
      A deep unwavering belief is a sure sign you're missing something...
    5. Re:Read the OSNews thread by Anonymous Coward · · Score: 0

      This reminds me of a consultant that worked for our company a couple of
      years back. He was trying to convince me that Java was faster than
      C for web applications (he was talking about execution speed). I couldn't quite
      understand his argument, so I asked him to point me to his source. He sent me an article
      that compared servlets with CGI programs written in C!. Minimal processing was being done by the servlet and CGI program. It was really a
      comparison between servlet and CGI frameworks. What a moron. And the guy
      was trhe "guru" of this "EBusiness Integrators" company. Sad.

    6. Re:Read the OSNews thread by javajedi · · Score: 1

      From
      The Java HotSpot Virtual Machine:

      "Just-in-time (JIT) compilers are essentially fast traditional compilers that translate the Java technology bytecodes into native machine code on the fly. A JIT running on the end user's machine actually executes the bytecodes and compiles each method the first time it is executed...
      [Hotspot] solves the problems of JIT compilation by taking advantage of an interesting program property. Virtually all programs spend the vast majority of their time executing a minority of their code. Rather than compiling method by method, just in time, the Java HotSpot VM immediately runs the program using an interpreter, and analyzes the code as it runs to detect the critical hot spots in the program. Then it focuses the attention of a global native-code optimizer on the hot spots. By avoiding compilation of infrequently executed code (most of the program), the Java HotSpot compiler can devote more attention to the performance-critical parts of the program, without necessarily increasing the overall compilation time. This hot spot monitoring is continued dynamically as the program runs, so that it literally adapts its performance on the fly to the user's needs."

    7. Re:Read the OSNews thread by FreshFunk510 · · Score: 1

      Yes another good point.

      This leads me to question whether it's even possible or relevant to compare these languages (as has been repeated many times over). Perhaps it's like comparing a hammer to a screwdriver (in the sense that people use the right language for the job).

      --


      "Injustice anywhere is a threat to justice everywhere." - Martin Luther King, Jr.
    8. Re:Read the OSNews thread by be-fan · · Score: 1

      Well that's nice, but the technology still isn't called Hotspot. Hotspot has an optimization technique that mitigates some of the traditional disadvantages of JIT. Most modern JIT compilers work this way too. In either case,t he performance property to which I was originally referring is not specific to Sun's Hotspot VM, but characteristic of *all* JIT virtual machines.

      --
      A deep unwavering belief is a sure sign you're missing something...
  43. 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!
    1. Re:Quoting the results section here... by zontroll · · Score: 1

      Lad's Host - there's no ' in slashdot...a more accurate anagram would be Dal Hosts (given the number of Indian techies out there. If you don't know what Dal is, ask your Indian coworker)

    2. Re:Quoting the results section here... by Anonymous Coward · · Score: 0

      you filthy karma whore.

    3. Re:Quoting the results section here... by Anonymous Coward · · Score: 0

      you filthy troll

  44. this is comparing libraries by Anonymous Coward · · Score: 0

    The guy's trig. VS. trig. stuff is just
    comparing libraries, not code gen.

  45. 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.

  46. Re:java vs C by j-b0y · · Score: 1

    Which is true, but missing the point somewhat. Given an half decent optimizing compiler, C/C++ should almost always be faster than Java, but not so much faster that the speed becomes a deciding factor over the advantages that Java has compared to C/C++.

    Now, there are always a certain class of programmer who must always have the absolute fastest performance possible. For them, C/C++ is the weapon of choice, if they don't have the time to hand-craft assembler.

    For everyone else, it becomes a decision based on personal perference, technical imperative, management decision or dogma.

    --
    Please remain calm, there is no reason to pani... wait, where are you all going?
  47. Except for games, who cares about speed by MarkWatson · · Score: 1
    OK, maybe I overstated that a bit :-)

    When I worked on Nintendo U64 video games (I mostly did the AI), we used C++ effectively to write fast code that was maintainable.

    However, no project that I have worked on since had the requirement for runtime performance over-trumping the huge gain of productivity of languages like Java, or better yet Lisp, Python or Smalltalk.

    Writing and maintaining software is a business - it the total cost vs. benefit that counts.

    -Mark

    1. Re:Except for games, who cares about speed by finkployd · · Score: 1

      Well, anyone writing servers as opposed to applications....

      I've never not been on a project where speed and performance were so important that C ended up being used (despite its shortcomings as compared to higher level languages). Granted I tend to do primarily security stuff for a large university, which is not really that common. But everyone's particular needs vary, and no language is ideal for everything.

      Finkployd

  48. The code is published. by rasilon · · Score: 1

    http://www.ocf.berkeley.edu/~cowell/research/bench mark/code/

  49. 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.
    1. Re:Not testing languages by happyfrogcow · · Score: 1

      does it suck? i've not had a commercial compiler since VC++ 5 or so, years ago. and that i never really used.

      how badly does it suck? i guess it wouldn't be too hard to find comparisons, preferably unbiased comparisons

    2. Re:Not testing languages by xtheunknown · · Score: 1

      Take a look at this article and this one. They cover perfromance of Intel's C compiler and gcc.

      --

      They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.
    3. Re:Not testing languages by FreshFunk510 · · Score: 1

      Mod this baby up!

      Yes, let me re-iterate, this is a test of compilers NOT languages.

      --


      "Injustice anywhere is a threat to justice everywhere." - Martin Luther King, Jr.
    4. Re:Not testing languages by gregfortune · · Score: 1

      Go right ahead and use VB then :)

      Although you say that comparisons between languages can't be made, we *must* do so as one of the metrics used to choose a language is speed. Realistically, the best we can do is pick the fastest compilers from each language at an instant in time and use those as a basis for comparing languages. Unless you expect signifigant advances to be made in the compiler front in some of the languages in the very near future, this should be reasonably accurate in practice.

  50. Re:java vs C by HappyClown · · Score: 1
    > Java isn't and never will be as fast as C/C++ Do some research. Theoretically at least, and increasingly often in practice, a dynamically optimized language will outperform a statically optimized language in many circumstances.

    Witness the huge performance delta between Java 1.0 and 1.4.2, and also realize that the dynamic optimizations performed by Hotspot are still relatively immature compared to the optimizations that are performed by your average C/C++ compiler, and you'll begin to realize that C/C++ is NOT the be-all and end-all of high performance code.

    As a rough analogy, how often have you profiled code only to be surprised at where the bottlenecks are? Chances are if you've done any serious profiling, this has happened to you often, perhaps even to the point where you don't bother optimizing code without profiling it first. A similar process occurs with static optimizations - the code is optimized without the benefit of knowing on what the common code paths will be, whereas dynamic compilation allows for code to be optimized based on the way it is currently being used. Sure, there's overhead in performing the statistical analysis and compilation at runtime, but it does NOT logically follow that this will cause dynamic compilation to be any slower.

  51. 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.
    1. Re:wrong questions by Cederic · · Score: 1


      Yeah, but I've been writing software commercially for almost a decade, and I've never yet needed a "true multidimensional array" and I've certainly never needed to write an FFT.

      If I were needing such things, maybe I'd use Matlab or C or FORTRAN.

      Until then, I'll pick a language that suits my needs (and, quite importantly, those of my employer) and not get my knickers in a twist about non-my-real-world scenarios that the language may or may not handle.

      ~Cederic

    2. Re:wrong questions by Anonymous Coward · · Score: 0

      "If I were needing such things, maybe I'd use Matlab or C or FORTRAN."

      Or use one of the readily available libs for your languge (Perl, Java, Python whatever) and get access to a very fast version.

      See Math::BigInt lib => 'GMP' for an example :)

      Cheers,

      Tels

    3. Re:wrong questions by ajagci · · Score: 1

      Yeah, but I've been writing software commercially for almost a decade, and I've never yet needed a "true multidimensional array" and I've certainly never needed to write an FFT.

      Well, thanks for at least being honest about your limited experience.

      Until then, I'll pick a language that suits my needs (and, quite importantly, those of my employer) and not get my knickers in a twist about non-my-real-world scenarios that the language may or may not handle.

      Do you deal with images? With graphics? With user interfaces? With databases? With spam? With audio? With speech? With video? Do you think that the libraries that support that functionality appear by magic? Do you think they don't cost anything to develop? Don't you mind when those libraries crash your application or create security holes?

      Since Java isn't up to it, those libraries are still written in C. That's why it took so long to get something like the Java imaging API and why it took even longer to get it ported to the main platforms Java runs on. That's also why so many audio and video codecs for Java media aren't available on Macintosh or Linux. "Pure Java" is a lie: in order to do most of the things people would like to do with Java, the JCP keeps having to define new native code modules.

      You may just be hacking application programs for a living, but you still depend on all those libraries and all that C code, whether you know it or not. And the fact that Java can't handle it means that your work gets a lot harder, even if you don't even realize it.

    4. Re:wrong questions by GrassyKnowl · · Score: 1

      I write my applications in Java so it can run on Windows, Linux, BSD, Mac OSX, Cell Phones, Solaris, AIX, etc.

      All without recompiling.

      If you want to use a different language that locks your binary into an specific compilation you are more than welcome to do that, but as for me, my application will experience no OS lockin.

    5. Re:wrong questions by aminorex · · Score: 1

      > I suggest you go through the following
      > exercise: write a complex number class, then
      > write an FFT using that complex number class...

      I suggest that you don't. It would be very
      unrepresentative of how one would solve the
      problem in Java. Instead, write a complex
      *array* class, and an FFT using that complex
      array class.

      --
      -I like my women like I like my tea: green-
    6. Re:wrong questions by Cederic · · Score: 1


      >> You may just be hacking application programs for a living, but you still depend on all those libraries

      Hacking applications? I fear not. Applying good software engineering practices to the creation of business software.

      I may have "limited experience" but I'm experienced enough to know that writing graphics, image, audio and video codecs and libraries is something that one person does, then distributes to many. Unlike the software I create, which one person does, then one company uses for many years. That's an entirely different paradigm to creating a graphics library; don't act so surprised that a different language is in use.

      "Pure Java" may be a lie; however I've used pure Java database drivers to connect to Oracle, I've used pure Java development tools and libraries that run on multiple platforms without recompilation, I've delivered systems that run equally well on Windows and Unix.

      Most of what I want to do with Java can already be done with it; the rest tends to be specific business logic that I'd have to write myself anyway. Since Java meets my needs, and supplies many advantages other than execution speed, it is the language of choice for the business I work for.

      I still haven't needed to write an FFT. Forgive me for being one of the millions of software engineers that falls into that category.

      ~Cederic

    7. Re:wrong questions by smallpaul · · Score: 1

      Actually, Python has a large (relative to the popularity of Python in other domains) and happy number-cruncher community. Numeric users include Lawrence Livermore Labs and NASA.

    8. Re:wrong questions by Anonymous Coward · · Score: 0

      And no one will use your vaporware. Yawn.

    9. Re:wrong questions by matfud · · Score: 1

      Java Advanced Imaging has been around for a long time. It took quite a while to be released as a "finished API" partly due to some fundamental changes needed in the AWT libraries. It is 100% java. There are additional native modules that can perform some of the operations slightly faster then the default pure java implementaion however they get most of thier performance boost from using platform specific hardware (SSE/MMX/other SIMD style hardware). If you were writing the same operation in C++ you probably would have to jump though hoops to use it too.

    10. Re:wrong questions by Anonymous Coward · · Score: 0

      I may have "limited experience" but I'm experienced enough to know that writing graphics, image, audio and video codecs and libraries is something that one person does, then distributes to many.

      You're experience enough to apparently have no idea what you're talking about.


      Unlike the software I create, which one person does, then one company uses for many years.


      Yeah, your work is largely redundant and has a fraction of the longevity. Your work requires little in the matter of talent, which is why your job is going to find its way on the shores of India.

      "Pure Java" may be a lie; however I've used pure Java database drivers to connect to Oracle, I've used pure Java development tools and libraries that run on multiple platforms without recompilation, I've delivered systems that run equally well on Windows and Unix.

      Wow, a subset of your programs are actually portable. Great work, Tex.

      I still haven't needed to write an FFT. Forgive me for being one of the millions of software engineers that falls into that category.

      You're not a software engineer, you're a java monkey. They really should institute State requirements for referring to yourself as a Software Engineer.

    11. Re:wrong questions by gumbi+west · · Score: 1

      dude, I use his vaporware! oh, wait.

    12. Re:wrong questions by ajagci · · Score: 1

      Instead, write a complex *array* class, and an FFT using that complex array class.

      Oh, and what do you propose array subscripting return from that complex array class? In fact, what do you propose "Complex.add(Complex)" return? Sorry, but you just haven't thought this through; there is no reasonable workaround for the lack of value classes in Java. If there were, language designers for languages like C++, Fortran, and C# wouldn't have gone through the considerable trouble of defining value classes.

    13. Re:wrong questions by ajagci · · Score: 1

      If you want to use a different language that locks your binary into an specific compilation you are more than welcome to do that, but as for me, my application will experience no OS lockin.

      I see: instead of being "locked into" an open, free standard with dozens of implementations, like POSIX and UNIX, you prefer to be locked into a single, proprietary language and library with only proprietary implementations, created by an ailing hardware vendor. Yeah, real smart.

    14. Re:wrong questions by Anonymous Coward · · Score: 0

      Which part of Python is unlikely to be a good language for Fortran-style numerical computing. did you not understand?

      Try defining a complex number class in Python and using it. If you run a factor of 100 slower than C/Fortran code and only use 10x as much memory, you are going to be really lucky.

      Python offers you Matlab-style numerical computing. That's nice for what it is, but it is quite limited.

    15. Re:wrong questions by Anonymous Coward · · Score: 0

      Dude, nobody likes using native Java applications. They don't feel like native Windows apps on Windows, they don't feel like native Mac apps on a Mac. And if you're going to tweak the UI and functionality to match the strengths of each platform, then you might as well have written and compiled separate versions in the first place. Sorry.

    16. Re:wrong questions by ajagci · · Score: 1

      Most of what I want to do with Java can already be done with it; the rest tends to be specific business logic that I'd have to write myself anyway. Since Java meets my needs, and supplies many advantages other than execution speed, it is the language of choice for the business I work for.

      How nice for you that Java meets your needs, but that is completely and utterly besides the point. The news item is about claims that Java implementations have become really fast. I'm pointing out that the benchmarks test only a tiny fraction of what you would need to test for in a meaningful benchmark and that Java still isn't anywhere near competitive with C/C++ on the kind of code people write in C/C++.

      Incidentally, it seems likely that you process a lot of strings in your work--guess what, Java is also very inefficient at that.

    17. Re:wrong questions by Cederic · · Score: 1


      Strangely enough, Java is fast enough for the uses I put it to.

      So C/C++ can do some things quicker than Java. Shrug. I don't care. The things I want to do in Java, Java can do fast enough. C/C++ can't do all that much (if any) faster.

      If you want to measure performance, let's consider time from "hey, we need some software" to "ok, data processing complete". That's the sort of speed that matters - maybe the benchmark should have checked for that..

      ~cederic

    18. Re:wrong questions by ajagci · · Score: 1

      If you want to measure performance, let's consider time from "hey, we need some software" to "ok, data processing complete". That's the sort of speed that matters - maybe the benchmark should have checked for that..

      You are so right that programmer productivity matters a great deal. Isn't it too bad that Java doesn't do that well either?

      For performance critical and numerical code, programmer productivity in Java is horrendously bad because the language has so little support for it; C++ and C# beat Java hands down in those areas in terms of programmer productivity in my experience. Trying to write numerical or high performance code in Java is an exercise in frustration and takes many times as long as in languages like C++ or C#.

      And for code where performance doesn't matter so much, Java seems barely better than C++ (it's slightly better mostly because it has garbage collection) and worse than C#. In my experience, highly productive languages are dynamically typed languages (Python, Smalltalk, Scheme, etc.), functional languages (SML, Scheme, Haskell, etc.), and logic programming languages (Prolog, etc.). Java just doesn't have the type system or means of abstraction to make programmers highly productive.

    19. Re:wrong questions by Trejkaz · · Score: 1

      Presumably they would have Complex.add(Complex) return a new Complex, just like in C++, and subscripting would return a Complex too. It wouldn't be an array so much as a List<Complex> with optimisation inside.

      Hell, if you were that paranoid you could make the whole FFT chunk native, assuming of course that nobody has done it before.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
    20. Re:wrong questions by Trejkaz · · Score: 1

      Do you deal with images? With graphics? With user interfaces? With databases? With spam? With audio? With speech? With video?
      ...
      Since Java isn't up to it, those libraries are still written in C.

      Images and Graphics: JAI. Admittedly there is a 'performance pack' release which uses native libraries to improve performance.

      User interfaces: AWT, Swing. For christ's sake you can't say these haven't been written in Java. Swing is even fairly fast these days!

      Databases: I can think of several entire databases written in Java, including Exist and HypersonicSQL. In addition to this most database client libraries are ported to Java for ease of use, even if the database itself is not.

      Spam: Well... you got me there. I can't think of a spam solution off the top of my head other than the Bayesian filtering module for the Java-based James mail server.

      Audio: JavaMedia. There is even 3D sound support in Java3D. And, like the JAI, there is a 'performance pack' for the performance whiners. However they recently removed MP3 support from the performance pack due to legal issues. Ogg forever!

      Speech: JavaSpeech. However I believe there is only one implementation of this in Java itself, the majority I've heard of are native.

      Video: Also JavaMedia. I actually grafted together a rather nice webcam streaming program in Java. The only reason I'm not releasing it is support for my particular webcam under JavaMedia on Windows is shoddy, and I don't want Windows users whinging about it not working.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
  52. 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..

    1. Re:Less simple benchmarks by IkeTo · · Score: 1

      In fact, even in C it is possible to benefit from run-time information. In particular, branch probability can be estimated by compiling the program twice, once to ask the compiler to record how many times each branch is taken, and once to ask the compiler to use the stats obtained to generate code. See the -fbranch-probabilities and -fprofile-arcs options of gcc.

    2. Re:Less simple benchmarks by Anonymous Coward · · Score: 0

      C is a language, not an implementation. Intel's compiler (and the next version of Visual Studio) has the option of generating statistics about your code so it can calculate the probabilities of things (mostly branch prediction I'd bet) so it can rewrite or reorder the machine code on recompiles.

  53. 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.

  54. 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

  55. Re:Java is dying by Orion442 · · Score: 1

    I'm just guessing here, but it sounds to me like somebody has had some less than good experiences with Java.

  56. .NET Languages and IL by FiskeBoller · · Score: 1

    Well, benchmarks are for testing assumptions exactly like yours. The reason bencharks are interesting is they often find discrepancies that vary from what we all believe. Also interesting to note that the source of many of those beliefs is the marketing behind .NET in the first place. If you've worked cross language .NET development, you know that all things are NOT equal. Ever dealt with variable parameter functions?

  57. 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 Anonymous Coward · · Score: 0

      >>> from time import clock
      >>> a = clock()
      >>> foo = 123 ** 1234567
      >>> b = clock()
      >>> print b - a, "secs"
      45.2345518774 secs

      Faster than my head, at least :)

    2. 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

    3. Re:Python Longs are arbitrary precision! by FiskeBoller · · Score: 1

      It would be interesting to see a closer "Apples to Apples" comparison, as you suggest. Personally, I would like to see how this stacks up against Smalltalk arbitrary precision, in varying flavors of Smalltalk (you could start with Squeak). There are Smalltalk benchmarks where functions like factorial easily beat C.

    4. Re:Python Longs are arbitrary precision! by Anonymous Coward · · Score: 0

      The same is true for Ruby. Perl only has the "long" integers as an extension, but Perl wasn't even benchmarked and in any event, a Perl scalar is a much more complex thing than an native integer so I guess it will be much slower, anyway. "use bignum" would make it even slower. But it would be comparing apples and oranges.

      Cheers,

      Tels

    5. Re:Python Longs are arbitrary precision! by PommeFritz · · Score: 1

      "limited only by your hardware"
      To be more precise: limited only by the available memory. Your statement might be mistaken as if python's numbers were limited by the 32/64 bits of your cpu...

    6. Re:Python Longs are arbitrary precision! by CmdrTHAC0 · · Score: 1

      Holy shit. If this is true, Python mops the floor with Perl on arbitrary precision. I have a Math::BigInt perl process doing only the long test which has been going on for 77:51 (min:sec) as I post this, whereas the entire benchmark in Python was over in 37:19. (I've constrained the accuracy/precision to ~67-bit range in Perl. It's still taking forever.)

      OTOH, my Python results are somewhat dubious, since it comes up with 10 billion instead of ~777 million for that test, claiming -2940 seconds for it. Subtracting the other times, it really took 23:02.

      --
      __CmdrTHAC0__
      In Soviet Russia, Spanish Inquisition doesn't expect YOU!!
  58. There's an old saying: by Anonymous Coward · · Score: 0

    "Horses for courses."

  59. Raw Speed vs Perceived Speed by DOsinga · · Score: 1

    I don't think it is very relevant how fast java can be in these kind of benchmarks for most applications. Usually the processor is not the bottleneck. What matters is the responsiveness of the userinterface. Java (Swing actually) still feels very sluggish even on faster computers. That is what is stopping the adoption of Java on clients, not the fact that triogonomy is slightly slower than when done in C++

    - - - - - - - - - -
    Sample my google hacks

    1. Re:Raw Speed vs Perceived Speed by Anonymous Coward · · Score: 0

      BINGO, a fact a lot of people miss out on.

    2. Re:Raw Speed vs Perceived Speed by FiskeBoller · · Score: 1

      Recently I saw comments where someone had separated out "performance" from "responsiveness". IMHO: More of this thinking needs to pervade software consciousness.

      I think it would be accurate to say that native applications are more responsive than Swing apps. On the other hand, I don't believe it's impossible to write responsive Swing apps; I've certainly seen and used some that rival native equivalents.

      My experience is that it takes a very talented Swing GUI engineer to create a responsive Swing application. Unfortunately, most IT departments don't have the type of resources required to pull it off. This is why VisualBasic and PowerBuilder win for custom departmental apps. I think with a suitable GUI builder, SWT stands a chance of competing in this arena.

  60. Re:java vs C by Doomdark · · Score: 1
    Java isn't and never will be as fast as C/C++, people who say "but oh it's compiled it runs just as fast" haven't a clue what they're talking about.

    Ok; due to your insightful explanation and supporting evidence, I now understand the situation completely. Apologies for spreading FUD about Java's acceptable performance.

    ps. Can you point me to the section(s) in kernel documentation that explain performance problems of Java compared to C or C++? I seem to have trouble finding it.

    --
    I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
  61. Issues with trig tests by richg74 · · Score: 1
    I have a couple of issues with the way the trig tests were done in this benchmark. (BTW, I have posted a similar comment on the original article at OS News.)

    First, if you read the description of the test, and look at the source code on the author's Web site, it is obvious that all of the computational "heavy lifting" is being done by the run-time math library routines (e.g., sin, cos, sqrt). I don't know offhand which languages use which libraries; it is not inconceivable that Python, say, uses the C math library. The only thing we can be sure is different in comparing languages is the function call overhead particular to each language.

    The second, and IMO more serious issue, is that the test incorporates no measure of how accurate the results are. This is a real issue, because these functions are generally evaluated using an economized power-series approximation. Caculating fewer terms of the series will results in faster execution, but diminished accuracy.

    To take a silly example, I can write a very fast C function to return the cosine of x:

    double cos ( double x ) {
    return ( 1.0 - ( (x*x)/2.0 ) );
    }
    (This uses the first two terms of a Taylor/Maclaurin expansion. It will be fast but not very accurate!)
    1. Re:Issues with trig tests by xenocide2 · · Score: 1

      It could be the case that certain language and platforms are using precalculated tables. at least with embedded systems with weak processors, precalculated results are popular. It becomes a tradeoff between memory and accuracy which you can custom tailor to your needs. On modern desktops, you could probably add such tables out to excruiating standards and get away with it without being noticed. If the trig tables aren't used often, they'll slowly migrate to disk cache. If they are, they'll be in RAM in a hurry.

      Indeed, if we consider benchmarking performance testing, then we need to consider accuracy and correctness first. This is one of the largest reasons gcc loses frequently -- it's one of the few that put correctness first.

      --
      I Browse at +4 Flamebait

      Open Source Sysadmin

    2. Re:Issues with trig tests by richg74 · · Score: 1
      It could be the case that certain language and platforms are using precalculated tables...

      Quite right. Using precalculated tables with interpolation is in fact a reasonable strategy under some circumstances. (Most Slashdot readers -- not I, alas -- are probably too young to have been taught how to interpolate in printed function tables. I still have my trusty copy of the AMS 55 Handbook of Mathematical Functions -- right next to my slide rule. ;-)

      As you said, accuracy is a primary issue. The earliest versions of Lotus 1-2-3 demonstrated how easy it is to get this wrong. They calculated standard deviation, not from the definition (the right way), but from a "shortcut" formula devised for a person using a desk calculator. This in some circumstances produced a horrendous loss of significance: the answer 1-2-3 came up with for the standard deviation of {999999, 1000000, 1000001} was negative! (The correct answer is obviously 1.)

      Someone once said that floating-point numbers are like a pile of sand: every time you move one, you pick up some dirt.

  62. eugenia applies for robbIE's online dating service by Anonymous Coward · · Score: 0

    in NINE languages? & still no takers?

    how cruel?

  63. AWFUL ADVICE by Anonymous Coward · · Score: 0

    dude, that's awful advice. You didn't provide any evidence, you just made fun of people who think differently than you.

    What would kernel documentation cover? Since the kernel contains no Java, I would say not a lot. The only thing of value you say is to tell people to test -- that's good, but you've told them what conclusion to reach. Why not provide some of your own answers? And, since there are lots of different kinds of code, you should be open to the fact that some code will run faster on some platforms, while other code performs better on other platforms.

    overall, good troll.

    p.s. C and C++ optimizations are very different. You shouldn't group them together. But you knew that, of course.

  64. Slow starting? It's pretty fast to me by lokedhs · · Score: 1
    A hello world program using JDK1.4.2 executes from start to finish in 0.08 seconds on my Athlon XP2400+ on Linux.

    I tested this with the standard "time" command like this:

    time java TheTestProgram

    I also downloaded the JDK1.5 alpha release and it is faster. I believe the license prevents me from publishing the actual numbers for a beta version but you can download the early access release and try yourselves.

    Yes, yes. I know C is much faster. But the point here is that you don't have time to react and notice wether startup takes 0.08 seconds or 0.008.

    1. Re:Slow starting? It's pretty fast to me by tomstdenis · · Score: 1

      I think the startup time is dominated by how many classes you import and how big your program is. A simple hello world program will obviously import in a minimal amount of code.

      Try comparing say a WM written in Java to on in C/C++.

      Tom

      --
      Someday, I'll have a real sig.
    2. Re:Slow starting? It's pretty fast to me by lokedhs · · Score: 1
      That's obviously true. It is important to remember that back in the days when Java was slow, starting a hello world program could take several seconds. Many people still remember their poor experiences with starting their simple test programs and decided that Java is, and forever will be, very slow starting up.

      I suggest these people try it again. They may be very surprised. :-)

    3. Re:Slow starting? It's pretty fast to me by Anonymous Coward · · Score: 0

      Now do it a million times in a script and tell me you can't notice any difference.

    4. Re:Slow starting? It's pretty fast to me by lokedhs · · Score: 1
      OK, so what you just said means that it's not a good idea to write certain shell commands in Java and start the VM every time you want to run them. I can agree with this.

      But, if you were to write a shell in Java you would most likely have the different shell commands as classes and use the Java dynamic class loading to add new shell commands. That way the whole shell session (and all the commands it uses) would be running in the same VM all the time and the startup argument no longer applies. In fact, this sounds like a fun project, and I suspect that someone has already done it.

    5. Re:Slow starting? It's pretty fast to me by oingoboingo · · Score: 1

      That's obviously true. It is important to remember that back in the days when Java was slow, starting a hello world program could take several seconds. Many people still remember their poor experiences with starting their simple test programs and decided that Java is, and forever will be, very slow starting up.

      That could also be more to do with people running a 200MHz Pentium MMX machine with 64MB of RAM when they first started playing around with Java, versus the 2000MHz Athlon XP machine with 1GB of RAM that they have now.

    6. Re:Slow starting? It's pretty fast to me by lokedhs · · Score: 1
      They have still done a lot of work making java starup much faster in later versions of the VM.

      To be honest I haven't run Java on an old 200 MHz Pentium in a long time, but I can guarantee that it will be a lot faster than the old 1.1 version was.

    7. Re:Slow starting? It's pretty fast to me by Anonymous Coward · · Score: 0

      No, it's not. I've got a 200MHz SGI O2, and Java is still painfully slow on it. Speed has actually gotten worse on old machines like this.

    8. Re:Slow starting? It's pretty fast to me by lokedhs · · Score: 1
      Weird. The relative speed in startup between 1.1 and 1.4 on similar machines has in my experience been an enormous improvement. Well, exclusing the initial 1.2 releases which were actually slower than 1.1.

      I find it surpising that the relative speed is the opposite on a slow MIPS machine. A problem with the IRIX JVM perhaps? Could you write a simple hello word program and run "time" on it on different JVM's on your machine? I'm not saying you are lying, I'm honestly interested in seeing what the relative speed differences are.

  65. 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.

  66. they forgot to test what people do most by oldwarrior · · Score: 0

    string handling in all varieties and data structure/collection manipulation. In my experience, C++ is orders of magnitude faster than java in these areas and .net will not catch up until it gets typed collections/templates next release. Java string handling makes ones hair hurt.

    --
    If it were done when 'tis done, then t'were well it were done quickly... MacBeth
  67. Java performace undel Linux by iezhy · · Score: 1

    Actually, IBM Java VM for Linux significantly outperforms Sun's. We have done some research on this topic in Aalborg University in Denmark. Final report is here (if anyone's intrested): http://kom.auc.dk/group/03gr841/pdf/Final_Report.p df

  68. 2 cents... by thoolihan · · Score: 1

    Interesting article, but I take it with a grain of salt.

    First, All tests done on Windows. Yes, it's the only platform that all those languages run on, but of course M$ languages are going to have an inside track on optimizing for their OS libraries.

    Regardless, programming should be done with the right tool for the job. If you were looking to write a utility that did heavy file i/o, I would stay away from an interpreted language. But if I were trying to write a cross-platform utility, I would certainly consider interpreted languages like Python or Java.

    Summary: No news here: Some languages are better at some taks then others. The developer has to figure out which fits the task and his/her own skills the best.

    -t

    --
    http://unmoldable.com W:"No one of consequence" I:"I must know" W:"Get used to disappointment"
  69. Why not Borland C++? by markhellman · · Score: 1
    I do not understand why Borland C++ Builder is systematically ignored when C++ compilers for Windows are considered. For many years, Borland C++ has been the best C++ development environment for Windows. Sure Borland compilers are not open-source, but a lot of open-source enthusiasts know that their struggle is not only about open-source, but also about promoting alternatives and fighting against monopolies.

    But despite the anti-Microsoft feelings shared by the majority of open-source community, every Windows version of open-source software (Apache, PHP, MySQL, etc.) is coded for Microsoft Visual C++... And, since everyone who wants to compile the sources needs a MS VC++ license, most Open-source software projects are, in practical terms, helping Microsoft get richer and strength its virtual monopoly!

  70. 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.

  71. Mod parent up! by ultrabot · · Score: 1

    True. This kinda invalidates that part of the benchmark, because they are not comparing the same thing.

    --
    Save your wrists today - switch to Dvorak
  72. Re:Quick! What's the difference between an apple a by Anonymous Coward · · Score: 0

    Wasn't sure about that one, which is why I ACed it.

    Seriously meaning this is the point.

    My point still stands, troll or not.

    Of course, here on /. the C zealots only want to hear about the speed of the code they produce, not it's utility, robustness, or anything else.

    Yes, Linux is written in C. Yes, it's very good. No, most people on /. can't write anything approximating it. No, most programs do not have the goals an OS kernel has.

    All I am saying is that performance is a terrible criteria for choosing a language when there are so many more important factors involved.

  73. 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.
  74. Submitter's Test is Invalid by Bob9113 · · Score: 1

    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.

    executed with java -server

    I would assume that the HotSpot compiler produces much better SSE2 optimized code than gcc. Without SSE2, Java's performance is worse in all respects tested here than native code compiled with gcc 3.3.


    Running short life tests with -server is not a good way to test Java's performance. Adding the -server switch increases the load time of the VM (while offering some long-term memory access speed advantages I think). This is fine on servers, which have a long life, so you don't care about startup time. Using it in a benchmark where the typical runtime is a few seconds is not a valid test.

    1. Re:Submitter's Test is Invalid by looseBits · · Score: 1

      He did not count the startup time of the JVM (or IL, etc)!! He used timming statements around the benchmarks to get the run time so the startup penalty of the server switch was ignored. Running it without the -server option would have slowed down the non-startup time of the program significantly.

      --
      Lord, bless my users that they may stop being such fucking idiots!!
    2. Re:Submitter's Test is Invalid by Bob9113 · · Score: 1

      He did not count the startup time of the JVM (or IL, etc)

      That's what I get for not reading the source code. I suck. Thanks.

  75. 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.)

  76. 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 nberardi · · Score: 1

      You are so right about performance, but performance is really negated in furture applicatiosn because of Moores Law. I am not saying you should be a slopper programmer, but performance of a compiled byte code isn't really as critical as if you were running on a Windows 95 machine with a 100 mhz.

      Plus assembly and low level C is now used in mission critical applications, not really in the business market any more because of the previous point on Moores law. But a missle guidence system is always going to need that low level perforance optimizations that only a human programmer can do.

    2. 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

    3. 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.
    4. Re:Language performance arguments miss the point by Tablizer · · Score: 1

      Agreed. For good or bad, most real-world apps don't do trig functions all day. These benchmarks are almost completely useless for comparing real-world needs. If you program things right, the language speed generally does not matter anyhow. Slow apps tends to come from stupid programmers who do things like execute 500 SQL queries in a loop instead of making a single nested query. More than 80 percent of all slowness problems I encounter are due to numbskul programmers. They will F-up any language.

    5. Re:Language performance arguments miss the point by FyRE666 · · Score: 1

      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)

      Of course, it was more fun (and a fair bit faster) to write direct to (y8)+(y5)+x ;-) Well that was if you didn't take the plunge and unchain mode 13h to use the (admittedly awkward yet advantageous) 31337 modeX...

    6. Re:Language performance arguments miss the point by Anonymous Coward · · Score: 0

      That is because VB coders hit a wall if they cannot find a pre-constructed component to do their work. C++ programmers typically biuld their own libraries over their careers, or can quickly reimplement a well understood design. Quickest way to make a VB coder faint - give him or her a blank slate. - Geccie

    7. Re:Language performance arguments miss the point by FyRE666 · · Score: 1

      Dammit! Lost the <<'s... Try again:

      Of course, it was more fun (and a fair bit faster) to write direct to (y<<8)+(y<<5)+x ;-) Well that was if you didn't take the plunge and unchain mode 13h to use the (admittedly awkward yet advantageous) 31337 modeX...

    8. Re:Language performance arguments miss the point by poot_rootbeer · · Score: 1

      For web apps, well, I stick around PHP/ASP.NET. Why? Portability!

      ASP.NET is portable?

    9. 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.

    10. Re:Language performance arguments miss the point by jwsd · · Score: 1

      Otherwise, the team could waste time checking for dangling pointers when instead it could be doing other things, like finishing up other projects.
      There is a software called CodeGlow that will find dangling pointers in C/C++ programs without requiring recompilation. I used it and was amazed by the result.
      I would say CodeGlow has eliminated most real life dangling pointer problems at very low cost.

    11. Re:Language performance arguments miss the point by jwsd · · Score: 1

      Sorry it should be GlowCode.

    12. Re:Language performance arguments miss the point by Anonymous Coward · · Score: 0

      lol, someone mod that up!

    13. Re:Language performance arguments miss the point by avida · · Score: 1

      Too bad your experience with Perl has been with shitty Perl developers. I've seen many large projects complete with Perl, and maintained successfully. YMMV as with any language.

    14. Re:Language performance arguments miss the point by Camel+Pilot · · Score: 1

      Why Python here is a better Benchmark showing Perl 3 time faster.

    15. Re:Language performance arguments miss the point by Anonymous Coward · · Score: 0

      "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."

      Why do you made the such an ignorant statement about Java? How many concurrent users do your web-based application handle?

      Java is *great* for web-based application that needs to scale up to handle ten of thousand of concurrent users.

      If you your web-based applications only serve limited users, go ahead and use PHP/ASP.net or whatever scripting languages.

  77. How the language is used is crucial by FuzzyDaddy · · Score: 1
    Benchmark code like this does not represent how these languages are used in practice.

    I think this is a really salient point. To do simple arithmetic functions in Java is not necessarily to write good java code. For example, if I wanted to do vector calculations in Java, I'd make a vector class and overload operations for addition, cross product, dot product, etc. Then I'd have a really convenient way to do vector calculations. A C implementation would be messier, but might end up being more efficient.

    I think everyone understands that different languages are good at different things (platform independence, performance, parallel execution, speed of development, and easy of GUI development are just a few relevant attributes), but what the language is used for will determine how you structure your program, which will in turn affect how efficiently it will execute a certain task. And this is differnt than attempting to compare a program written in C to a program written in Java as if it were C. That will be as much of a determinant of how fast a program in a given language seems, as the low-level implementation details.

    --
    It's not wasting time, I'm educating myself.
    1. Re:How the language is used is crucial by Anonymous Coward · · Score: 0

      "A C implementation would be messier"

      Why would a C implementation be messier? You would do exactly the same thing as you propose doing with Java -- create a vector class.

    2. Re:How the language is used is crucial by starm_ · · Score: 1

      For example, if I wanted to do vector calculations in Java, I'd make a vector class and overload operations for addition, cross product, dot product, etc. Then I'd have a really convenient way to do vector calculations. A C implementation would be messier, but might end up being more efficient.

      Use C++ best of both worlds!!!

  78. Benchmarks? Who cares? by FJ · · Score: 1

    Benchmarks are just that. Benchmarks. A general guide to general performance. There never has, nor will there ever be, an all encompasing benchmark.

    Thing of all of the parms which go into application performance. CPU (speed & quantity), memory (usage, speed, quantity), disk space (speed, defragmentation amount), and cache utilization are just a few of the big ones.

    Think of the amount of impact the coder makes. Do they constantly free & release memory as opposed to maintaining internal buffer pools in their application? Do they write code to take advantage of multiple CPUs? Do they constantly read & re-read the same files which almost never change?

    How about compiling & linking flags? Do they optimize for the x386 architecture or they optimize for the specific CPU?

    I've seen really poorly written programs in C that are slow. I've seen well written programs in Java which perform nicely.

    I'm not saying that the results of a benchmark are useless, but use them as a guide rather than a rule. The only real performance you need to worry about is your application's performance.

  79. 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.

    2. Re:trig calls in gcc by mrt300 · · Score: 1

      The gcc option is -ffast-math, which enables a host of math "optimizations".

  80. so what is measured? by Vladimir · · Score: 1

    Running benchmarks on a laptop is at least strange. Benching simple loops is telling, but telling wxactly what? That java is good for empty loops? A much more interesting comparison would be to see how commonly used idioms scale/perform in different languages. For example, say I extensively use maps, how expensive is map in Java, C#, Perl, etc? Can I insert 200M elements? what is the average time of insertion, etc.

  81. Java as fast as c++????? by rongage · · Score: 1

    Obviously, anyone who jumps to this conclusion has NEVER ran the Eclipse IDE before.

    I like Eclipse, don't get me wrong, but ANY editor that keeps the CPU running at around a 70% load while just editing a file or 2 is just plain wrong.

    --
    Ron Gage - Westland, MI
    1. 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"

    2. Re:Java as fast as c++????? by Anonymous Coward · · Score: 0

      and how is this worse than Word, which actually manages to eat up 90% of the CPU while typing. Give it a try.

    3. Re:Java as fast as c++????? by kelzer · · Score: 1

      What version?

      What platform?

      What plugins?

      I'm running Eclipse 3.0 M6 on a PIII/733 with 512 MB of RAM right now and it's using virtually no CPU. Its performance in general is plenty fast. I suspect something's wrong with your setup, because I personally have never seen it do anything like that with any version on any system.

      --

      ---------------------------------------------
      SERENITY NOW!!!!!!!!!!!!!!!!
  82. "They"? "Someone"? by A+nonymous+Coward · · Score: 1

    How about you? You care; they only had time to do so much; seems like you would be the obvious choice.

  83. 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.
    1. Re:Totaly missing parts by iapetus · · Score: 1

      I'd be interested in seeing the Java code for those benchmarks: if it's that terrible, I'd suspect overuse of the String class as a culprit.

      --
      ++ Say to Elrond "Hello.".
      Elrond says "No.". Elrond gives you some lunch.
    2. Re:Totaly missing parts by Anonymous Coward · · Score: 0

      There are two reasons for this:

      (1) String is immutable in Java meaning that if you use the String class exclusively then you are creating and destroying many, many objects.

      (2) StringBuffer (the recommended approach for heavy string manipulation) is synchronized which means that you are gaining and releasing a hell of a lot of locks for even a simple String concatenation. JDK 1.5 will introduce a new StringBuilder class that works the same was as StringBuffer without the synchronization.

  84. Something's fishy by Bill+Barth · · Score: 1
    I just ran his benchmark with gcc 3.3 under a RH9 linux box with my hand built 2.4.23 and got the following gcc results:

    8.8 19.0 8.66 4.35 0.7 40.81
    compared to his results of
    9.8 28.8 9.5 14.9 10.0 73.0

    The columns are the same as his; all numbers are times in seconds. Same compiler flags as his gcc test (except for the -fno-cygwin which isn't aplicable). My system is a 1.4GHz Pentium M (compared to the 2.0GHz Pentium M used in his test). No particular precautions against background processes were taken (in fact I was browsing the osnews site while it was running on another desktop).

    Things to note:

    1. My long math results is nearly identical to his Visual C++ result (within a second).
    2. His VC++ doulbe results are still better than mine.
    3. My trig results are comparable to his best (taking the "double" result into account).
    4. Linux blows Windows out of the water in the I/O world (?? maybe he doesn't have DMA turned on on his laptop HDD ??).
    --
    Yes...I am a rocket scientist.
    1. Re:Something's fishy by dubstop · · Score: 1

      Is this a troll?

      You're running the benchmarks on a slower machine, under a different operating system, compiled with an earlier version of the compiler, and you were browsing a web site while running the benchmarks, and you're surprised that your results are different to his? Under those circumstances, I would guess that using (almost) the same compiler flags as him means very little.

    2. Re:Something's fishy by Bill+Barth · · Score: 1

      No, my results were better than his inspite of the limitations listed in my first post! My point was that it's not gcc that's sucking but its implementation under Cygwin. Something needs adjusting in his analysis.

      --
      Yes...I am a rocket scientist.
  85. It's been paraphrased before by F.O.Dobbs · · Score: 1

    Lies, damned lies and benchmarks.

  86. An clearer explanation by Anonymous Coward · · Score: 0

    It seems quite obvious that you have never written C# code before. :)

    Care to offer what parts of the C# language is integrated into Windows? You'll find nothing, because C# is just a language, not a platform, not a library. Perhaps you meant the .Net framework is tied into Windows?

    The library C# uses (and indeed all managed languages) is the .Net Framework Class Library. The .Net FCL's source code is freely available, and virtually all the code is non-proprietary. The only considerable portion of that library that is proprietary (ie tied into the OS) would be the GUI library (System.Windows.Forms), understandable since it sits on top of Win32.

    Microsoft even has an implementation of the common language runtime (and hence C#) on FreeBSD. Additionally, Mono has implementations of the CLR on Debian, RedHat, Mandrake, and SuSE.

    Therefore, C# can run on Windows 98,ME,XP,2k, FreeBSD, Debian, RedHat, Mandrake, and SuSE.

    Next time, do a bit of research before spoutting your rant.

  87. Virtual Function Calls, Array Access, Memory Manag by Anonymous Coward · · Score: 0

    Wow, and this cat went to Harvard?

  88. Poorly designed microbenchmark by wpugh · · Score: 1

    The benchmarks are poorly designed microbenchmarks. Why do people pay attention to such things? See Cliff Click's talk on "How NOT To Write A Microbenchmark".

    We've done some of our own cross-language benchmarking. The NASA Advanced Supercomputing Parallel Benchmarks are problem statements for serious computation science problems, and solutions can be written in any programming language. We implemented the sparse Conjugate Gradient benchmark, and compared Java against fastest Fortran/MPI implementation on a cluster of 32 linux workstations. Java performed at essentially the same speed as Fortran/MPI (actually a little faster on 16 nodes). Although Fortran was slightly faster at the sparse matrix-vector product, Java communications using Java nio was faster than using the LAM implementation of MPI (the MPICH implementation was much worse than the LAM implementation).

    1. Re:Poorly designed microbenchmark by BrownTiger · · Score: 1
      Those benchmarks are totaly useless.

      Author proved, that when executing int & floats language overhead is little and most languages executed at same speed. Wooo.....

      Java app slow and sluggish. Try Swing vs VC++ GDIs, CreateWindow performance, database access type JDBS IV driver vs native ODBC ( ADO, SQL*NET ).

      I can not even begin to understand why author choose floatpoint test. How many production applications even use that?

      IO test author choose to compare java lazy writes with C posix file. What exactly does this prove?

      Brian

  89. 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.

  90. FORTRAN? by Anonymous Coward · · Score: 0

    People always rave about the speed of C, etc, etc. But what about fortran. It would have been neat to see how fortran stacked up. Though I am not sure how good MS's Fortran compiler is.

    It is hase been a few years since I did any F77 coding, but half of our shop is F77. We use C/C++ for interfacing, and applications, but the number crunching stuff is done by Fortran.

    Every now and then we do a little benchmark b/n F77 and C, and F77, just to remind ourselves why the number crunching is done in such a primitive languge.

    I am just happy that I don't do procedural programming, and thus don't have to work with it. :-)

    ~S

    1. Re:FORTRAN? by jabberjaw · · Score: 1

      I would be interested to see how FORTRAN stacked up as well. As someone who may pick up a physics B.S. I would enjoy making use of the extensive FORTRAN libraries. Yet, I have heard that many are being converted to C++. Perhaps someone my language literate than I could care to comment?

    2. Re:FORTRAN? by Anonymous Coward · · Score: 0

      If you want a C++ LAPACK, use this:

      http://math.nist.gov/tnt/

  91. 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 Anonymous Coward · · Score: 0

      When the first automobiles were made, people were satisfied that they could go almost as fast as a horse. Pretty soon, they wanted to go faster than a horse. It was quite a while before they could go faster than a train.

      I don't think you'd be happy with a 20HP motor in your car. Why are you so obsessed with speed?

    2. 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
    3. 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.

    4. Re:These kind of benchmarks are so 1970s by Anonymous Coward · · Score: 0

      "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. "

      I do the same for Perl (search.cpan.org for Math::BigInt) and I really like this optimization approach: fast code development, optimize later (and get rewarded by having a lot to optimize).

      Cheers,

      Tels

    5. Re:These kind of benchmarks are so 1970s by Anonymous Coward · · Score: 0

      Not everyone is concerned with commercialism.

      It is exactly your kind of thinking that makes a 1000 MHz machine appear slow.

      Many programmers think they can get away with almost anything. "Machines are always getting faster, by the time we release the new hardware will make this thing feel fast too."

      Why bother asking the OS to sleep, I'll just loop a few million times... *vomit*

      Come on!.. Have some common sense! Write code the best you can, just don't waste time on it!

    6. Re:These kind of benchmarks are so 1970s by jwsd · · Score: 1

      Speed and memory usage do matter, even today.
      Any computer science student knows that many important computer algorithms are designed to deal with problems that grow in difficulty exponentially. For problems that grow in difficulty expontionially and cannot be further reduced, even today's hardware is not enough to handle. In those cases, the performance boost obtained by C++ is a real differentiator. Since there aren't many such problems, the current small pool of experienced C++ programmer are enough to work on such software. And for truly experienced C++ programmers, Java doesn't offer that much value. For example, truly exceptional programmers don't produce memory leaks.
      I will choose Java for most mundane tasks because I can type less code. Typing less code doesn't automatically mean less development time. How much development time is actually spent on typing? Since the code is mostly bug free to begin with, the other Java benefits don't apply either. But to claim that Java alone is good enough to replace C++ tells people that the claimer hasn't seen enough software problems yet.

    7. Re:These kind of benchmarks are so 1970s by 16K+Ram+Pack · · Score: 1
      Code speed is becoming as important for PCs as it was for mainframes years ago.

      I forsaw a few years ago the virtual end of C++ for business apps (OK, not that great a guess) on the basis that as machines got faster, the speed of execution would become less important.

      Granted, there are always times for C++ - games, major packages, embedded devices and occassionally for common libraries. But it's often going to be a cost toss-up. If you're writing a library used in a system by 10 users, is it worth it? For 1000 users, the extra cost may be.

      What's more important now is disc and network IO. That's where performance gains can be greatest for smallest amounts of work.

    8. Re:These kind of benchmarks are so 1970s by matfud · · Score: 1

      For most porblems of this type the only effective optimisation is to find a more efficient algorithm that allows the problem to scale more favourably (perhaps using stochastic methods). That is not always possible of course. Constant time optimisations tend to be a waste of time.

      There is always a trade off between development cost, maintenance cost and the cost to use it. For a large software dev company developing a program it would often make sense to use the fastest language/compiler/libaries/talent available as they will sell or not sell thier software of the perceived speed. Perhaps the company will sell it on better security in which case the optimisation is a waste of time.

      Optimisation is not always necessary. In many cases it is cheaper to throw more hardware at the problem. In many cases it is necessaray, however most slow software I have come accross is slow because of poor algorithm design not the efficency of the language. In a few cases making a function 5% faster is important.

      matfud

    9. Re:These kind of benchmarks are so 1970s by jwsd · · Score: 1

      Another problem is memory. Our company's product allocates/frees memory all the time (for good reasons). Simply replacing the standard C runtime heap library by a special heap library has improved performance by 300%. That means an one hour operation gets cut down to 20 minutes, a very meanful improvement for end users. Also thread specific heaps make 10 times difference in terms of performance when concurrent operations are running simultaneously. May be I am ignorant but as far as I know, Java's GC is not cut for this kind of requirements.

    10. Re:These kind of benchmarks are so 1970s by matfud · · Score: 1

      Javas GC's may well surprise you. (Yes there is more then one GC that you can use (different GC's map to different problems and all of them are heavily configurable for specific scenarios). Mark and sweep GC can be significantly more efficient then many C heap management implementations because of the way in which it works. It tends to reduce memory fragmentation and improve memory cleanup (by operating on larger lumps of it)

      More recent versions of the GC also allow partial concurrent collection to take place which can significantly improve performance for some types of memory usage.

      Wether it will solve your problem well I cannot say but don't rule it out just because you have a difficult problem.

    11. Re:These kind of benchmarks are so 1970s by Rich0 · · Score: 1

      Most applications which are developed only run on a handful of machines. They are developed by companies to accomplish a specific task - maybe to glue two systems together, or to process some data into a report. Speed usually isn't critical, and when you're spending $100,000 on software development does it really matter that you're going to need to spend an extra $2000 on a server?

      If the application is geared for the mass-market, then speed is obviously more critical. You can spend an extra $100,000 on optimizations and make it back by charging an extra $5 per copy for the software.

      Usually all you get by writing everything in C is a bunch of buffer overruns and memory leaks.

  92. This benchmark is biased by imbaczek · · Score: 1

    This benchmark strongly favours languages compiled to native code. A much better place to seek language comparisions is The Great Language Shootout, even if it hasn't been updated for 2 years or so. (There's a more up-to-date version, albeit Windows-oriented, at The Great Win32 Language Shootout.)

  93. Only fast in certain things by dwk123 · · Score: 1

    When operating on native integer types, Java does in fact perform comparably to compiled code - as it should, since the JIT compilers should produce very very similar code.

    However, Java does have some inherent qualities that cause poor performance in typical real-world apps.
    -GC is required, and is slower than heap management.
    -lack of documented/fixed object layout precludes direct memory manipulation of data - mostly a problem in I/O. This makes block-based I/O virtually impossible without serializing.
    -The 'Design Patterns' that have been adopted as Gospel by most in the Java community (at least the J2EE community) are very inefficient - too many layers, too much indirection, too many object copies etc.
    - Swing. ugh.

    None of these are fatal problems, and I know from experience that it's possible to create very good performing Java apps, but it's not easy. You have to fight the language in some cases, and you can't follow the 'Java Purist' crowd in many cases.

    1. Re:Only fast in certain things by maraist · · Score: 1
      lack of documented/fixed object layout precludes direct memory manipulation of data - mostly a problem in I/O


      Just FYI, this is fixed with NIO. The idea is that you have a generic class to a byte-stream, which MAY be backed by non-relocatable, non-gcable memory. I believe this would generally require a native method to set up the memory-block (or the use of some java library which already does), but the idea is that it is handled.

      And while I agree with your argument that it's the paradigms of java which impeed it's performance, we are seeing ever more incursions of high-perf. paradigms enter into the core language (noting that you always had the possibility of writing such routines and UNIX sockets, static memory regions, UNIX selects, etc, just that it wouldn't be portable).

      And there is one advantage that Java has over staticly compiled languages.. It's JIT facilitates run-time optimizations.. Things that are RARELY ever utilized by static compilers.. They've always existed, but only big labels ever bother with them. Often this is useful in deciding which branches to take in if-statements, or to decide when to inline (cache-space/subroutine-delay trade-off)

      --
      -Michael
    2. Re:Only fast in certain things by the+quick+brown+fox · · Score: 1
      When operating on native integer types, Java does in fact perform comparably to compiled code - as it should, since the JIT compilers should produce very very similar code.

      True, but it's worth pointing out that once you start talking about arrays of ints, the picture changes dramatically since Java does runtime checks for out-of-bounds conditions on every array access.

      GC is required, and is slower than heap management.

      Just a technicality, but, my understanding is that GC is actually faster than heap management (at least in theory). With GC, you don't pay for memory deallocation until you need it, and when that time comes, the cost is proportional not to the amount of garbage you've created, but to the amount of non-garbage that needs to be preserved. (That's true with copying garbage collectors, at least, which is the kind Sun's JVM uses most often.) And since most real-world apps' memory usage patterns tend to create 10X more short-lived objects than long-lived ones, you should be able to end up with a net savings most of the time by using GC.

      Maybe what you meant was that GC is slower than stack management, or that GC causes unpredictable pauses during long "stop-the-world" collection operations (that plagued early versions of Java but are pretty rare now, due to some hard work by the folks at Sun).

      -lack of documented/fixed object layout precludes direct memory manipulation of data - mostly a problem in I/O. This makes block-based I/O virtually impossible without serializing.

      I'm not familiar with this problem. Could you elaborate?

      -The 'Design Patterns' that have been adopted as Gospel by most in the Java community (at least the J2EE community) are very inefficient - too many layers, too much indirection, too many object copies etc.

      I hate J2EE "Design Patterns" too, but in most real world enterprise apps, your performance is generally going to be totally dominated by either network I/O or database queries--stuff like in-memory object copies or indirection is like line noise.

      - Swing. ugh.

      Ugh indeed. :)

    3. Re:Only fast in certain things by decaf_dude · · Score: 1

      I've never met code written using well-accepted Design Patterns that I was unable to maintain without problem.

      I've rarely seen code written by the likes of you who shun good design over irrelevant performance issues that I could maintain at all.

      I've *never* encountered a well-designed distributed app that cannot be scaled with hw.

  94. What about... by catdevnull · · Score: 1

    There's no metrics for how these languages perform on various platforms. I think that would be more interesting. Of course, not all languages run on all platforms...maybe that's a disadvantage to certain languages.

    --

    I might know what I'm talkin' about, but then again, this is Slashdot...
  95. Re:"They"? "Someone"? by smartin · · Score: 1

    I've done it, currently my C/C++ is fairly rusty and i'd say it takes me about 10 times as long to develop and debug something in C++ than it would take in Java. If my C++ skills were equal to my Java skills, i'd imagine that this ratio would drop to maybe 5 times as long.

    --
    The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
  96. 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.

  97. Re:java vs C by Anonymous Coward · · Score: 0

    Tirel is a know karma whore troll. Please do not click on his sig as it is a redirect to goatse.cx. Please look at his history before modding. Do not encourage trolls to post trash like this.

  98. There's a big glaring flaw in your logic. by Anonymous Coward · · Score: 0

    Java and C# is a vendor having you by the balls. How many platforms have C# or java support? How many platforms have C and C++ support? BIG fucking difference there, you have no control over java or C#, sun and microsoft respectively have complete control over them, and as such, over you. What is needed is an OPEN, PORTABLE, safe high-level language.

    1. Re:There's a big glaring flaw in your logic. by FiskeBoller · · Score: 1

      I challenge your logic: How many times has OPEN been important for a language? Do/did you actively lobby the ANSI committee for ANSI C? Have you participated in any other standards bodies? Do you participate in the JCP for Java?

      My assertion is that most often this is a moot point. If the language is sufficiently available on multiple platforms and from multiple vendors you prevent lock-in (e.g. choose Java flavors from Sun, IBM, or BEA). More-over, some type of standards will assure 3rd party library consistency.

    2. Re:There's a big glaring flaw in your logic. by Anonymous Coward · · Score: 0

      Problem is that to do any useful business programming in C/C++, you will need to link to all sorts of vendor libraries*, and that puts you in the same lock-in situation as you're in with Java/C#.

      * and I'm including Open Source stuff here too, because ultimately the users have very little control over the direction of these projects.

  99. 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?

  100. Other considerations by digitalhermit · · Score: 1

    Last night I attended a Linux user group meeting in South Florida. One of the speakers, Reinhard Wiesemann from the LinuxHotel (LinuxHotel) in Germany mentioned something very interesting. He said that he'd been using a Unisys system. At some point, when the machine itself became outdated, a colleague showed him Linux. He was able to take his source code, re-run gcc, and *it worked*. He did mention some high-order problem that was fixed by a short program (he didn't know about the gcc flag that would have solved this).

    The idea that he could take 15yr old code and have it just work is pretty amazing. Imagine the time and development resources saved on this project alone.

    So there's a lot to be said for portable code...

    In a similar vein, I've recently been experimenting with the latest Sun Java on an older laptop using Fedora Core 1. I'd always heard that Java was slow, and it was on earlier setups. But it seems to work wonderfully with Fedora. It might be the MPTL or the 2.6.0 kernel I dropped in, but everything seems as good as native QT or GTK+ apps.

    Now I don't trust Sun fully after their comments about Linux, but in this case I can separate the technology from the company and say that the portability is a good thing.

    1. Re:Other considerations by Anonymous Coward · · Score: 0

      That link should be LinuxHotel (http://www.linuxhotel.de).

  101. OSNews? Let it go... by Gothmolly · · Score: 1

    Please let this site end up in the Internet dustbin with all the other crappy 'I installed the OS so now I am a reviewer' sites. What value do they actually provide? Deprive this hag of page hits and she'll go away.

    --
    I want to delete my account but Slashdot doesn't allow it.
  102. How about I/O by panker · · Score: 1

    I read large data files into large arrays in memory. (~2 GB files into 2GB of RAM) and for this task Java is unbearable. I am not that stellar of a Java programmer I know, but I am not that stellar of a C programmer either, and C handles this task nicely.

    I am doing this on an SGI, so maybe it is their Java interpreter that sucks?

    --
    move along, nothing to .sig here.
  103. One word.. by Sanity · · Score: 1

    ...well, actually an acronym - SWT.

  104. Re:"They"? "Someone"? by yamla · · Score: 1

    I'm curious, why the difference? I presume you are using smart pointers (www.boost.org) and other such additions to the C++ world, and of course you are using STL and the standard library string type. With all of that, you should virtually never need to do pointer arithmetic (though it is still available if you want to) so that whole category of problems is eliminated. So, what else is causing you to be so slow?

    Perhaps it is the graphical user interface, though this isn't really fair as C++ doesn't have one. I use Qt and while it costs a substantial amount of money, I find it to be of very high quality. I can write high quality UI in C++ as fast or faster than in Java.

    I'm not saying that C++ is better than Java. There are many reasons I'd still want to use Java. However, I just don't see that it is possible that Java could be five times faster to write than C++ for a programmer with the same level of skills in both languages.

    --

    Oceania has always been at war with Eastasia.
  105. 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.

  106. Doesn't seem to be so by r6144 · · Score: 1

    Just look at the assembly. "fsin" and "fcos" (and especially "fsincos") are usually faster than software-based versions, but the latter must be used if you need strict standards compliance. If you don't need that, "-ffast-math" or "-mno-ieee-fp" is needed for gcc (but for MS and intel's compilers, you need to specify an option for strict compliance).

  107. Last place seen: Futurama by FerretFrottage · · Score: 1

    Last time I saw Fortran was on Futurama when Bender order "Ole Fortran" beer http://www.windmeuptoys.com/product.asp?product_id =2600

    --
    "Look Lois, the two symbols of the Republican Party: an elephant, and a fat white guy who is threatened by change."
  108. Time to defend C++ (again)... by master_p · · Score: 1

    If you use the proper libraries, then C++ becomes as effective as Java. By proper libraries, I basically mean the Qt library. I work in the sector of defense applications, and in our company, the C++ teams are *more productive* than the Java ones from the moment we got Qt!!! It's an incredible library that proves the strength of C++...it even automates memory management.

    There are also other good libraries, although not for GUI, like boost.

    So, the 'huge advantage' of Java over C++ is only on paper...it's pure hype. Nothing can beat a Qt application in development speed, as you get the best GUI, automated memory management and the flexibility of C++ in one package.

    And here some 'gotchas' in Java that you maybe haven't thought of:

    In Java, you still have to do memory management!!! despite what the literature says, if you don't make pointers NULL, then objects will not be deleted!!! You still have to check if those pointers are NULL, eitherwise your application will crash...

    In Java, you can't use the RAII technique, so you have to explicitely 'shutdown' objects by calling a method of them which is named differently in each object, whereas in C++ the destruction of the stack-based object takes care of the side effects...

    In Java, each cast is dynamic, since all methods are virtual by nature (unless declared final, of course). Applications that make heavy use of collections are much slower in Java than in C++, due to the cost of the dynamic cast. The slowness of a Java app rises proportionally to the number of casts the application has...the benchmarks certainly did not show that, did they ?

    1. Re:Time to defend C++ (again)... by Darren+Winsper · · Score: 1

      "In Java, you still have to do memory management!!! despite what the literature says, if you don't make pointers NULL, then objects will not be deleted!!! You still have to check if those pointers are NULL, eitherwise your application will crash..."
      Err...no. I suggest you read up on Java's GC system.

      "In Java, you can't use the RAII technique, so you have to explicitely 'shutdown' objects by calling a method of them which is named differently in each object, whereas in C++ the destruction of the stack-based object takes care of the side effects..."
      You mean "finalize()"?

      "In Java, each cast is dynamic, since all methods are virtual by nature (unless declared final, of course). Applications that make heavy use of collections are much slower in Java than in C++, due to the cost of the dynamic cast. The slowness of a Java app rises proportionally to the number of casts the application has...the benchmarks certainly did not show that, did they?"
      That's only so true, since one of the things HotSpot does is "de-virtualize" methods which aren't overridden in the currently loaded classes.

    2. 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.
    3. Re:Time to defend C++ (again)... by Darren+Winsper · · Score: 1

      I'm well aware of the difference, but I was pointing out that finalize is the same name for every class. At least, it should be. If some idiot wants to call their finaliser "finish", it would be akin to making a C++ class with a "dispose" function that must be called before you delete it.

    4. Re:Time to defend C++ (again)... by Anonymous+Brave+Guy · · Score: 1

      Fair enough, but the point you disputed was that in Java you can't use the RAII idiom. You can't. RAII relies on destructors because they are:

      • guaranteed to be called automatically
      • called at a 100% predictable point.

      Neither of these applies to finalize().

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  109. Asinine Comparison by MidKnight · · Score: 1

    Quoting the post:

    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.

    Reading the author's analysis of his results, we eventually get to this statement:

    Comparing my results to those of the original author, there are three possible explanations for the descrepancies between his findings for gcc vs. Java performance....

    So, he's wondering why his benchmark (on Linux, AMD/Athlon) provides different results from the OSNews article (on Windows, Intel/x86). Let's see... different hardware platforms, different JVM implementations... where-oh-where could the differences lie?? He continues a bit later:

    The second (possibility) is that the JRE implementation on Windows is much better than on Linux. I would also guess that this is not the case, and would expect them to function with more or less equivalent performance.

    Why would he guess that? What rationale supports that view? Somehow I don't think the JVM team at Sun spends gobs of time optimizing their implementation** for AMD/Linux. I'd "guess" that Windows x/86 is a bit higher on their priority list. But maybe I'm missing something.

    In short, nothing to see here, move along to a more "insensitive-clod" or "... beowolf cluster"-friendly article.

    --Mid

    ** Lest people forget, the Sun JVM is a reference implementation. You want performance? Try using an alternate clean-room implementation that was built for performance.

    1. Re:Asinine Comparison by Anonymous Coward · · Score: 0

      completely correct. the order of jvm goodness goes: jrockit 8/linux (tied with) ibm/linux, ibm/windows, jrockit/windows, sun 1.4.2/solaris, sun 1.4.2/linux, sun/windows, sun 1.4.1/solaris. i'm not sure why no one understands the "reference implementation" part. reference implementations should be benchmarked for correctness, not speed.

  110. Re:Speed? No. Stability. Yes by abigor · · Score: 1

    I had heard that templates were in the works for Java 1.5...? I certainly hope so. I am addicted to the STL, and generic programming in general.

    As for the garbage collection, Java's GC algorithm is quite good, according to execution profiles I've performed - it doesn't block everything to perform the collection.

  111. 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!

    1. Re:Why no ActivePerl? by Anonymous Coward · · Score: 0

      Lazyness? I would like to see a Perl comparisation...

      Cheers,

      tels

    2. Re:Why no ActivePerl? by Anonymous Coward · · Score: 0

      Actually I would love to see a comparisation since I have no earthly idea what the hell that word means.

    3. Re:Why no ActivePerl? by JudasBlue · · Score: 1

      "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?"

      No, there isn't. I will say upfront that I am heavily baised for Python, and do everything I can in it, but when it comes to raw speed, the last numbers I saw show that Perl is about twice as fast. Those benches are for python 2.1 tho, which is quite a ways out of date.

      Since then, python in 2.3 has gotten about 30% faster and apparently the devs think that it can take Parrot.

      However, I don't code in Python for raw speed, I code in it for productivity and maintainablity, and there it saves me a tremendous amount of time over most everything else, but your milage may vary. For the kind of stuff I do, I swig out to native C once in a blue moon, but mostly the speed thing isn't an issue for me.

      --

      7. What we cannot speak about we must pass over in silence.

  112. Shame no Limbo by DrSkwid · · Score: 1

    because the Inferno VOS kicks the crap out of the Java platform.

    --
    There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
  113. oh yay by iggychaos · · Score: 1

    Yay - another microbenchmark. And this tells us what - that the Java JIT guys have the advantage of runtime dynamic performance manipulations of small loops?

  114. 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.

    1. Re:Problem: Java not portable by Cederic · · Score: 1


      Which makes you a very unusual person.

      Most people hate porting c/c++ between platforms, because it can (and often does) take an immense amount of effort. Not to mention the number of Windows programmers who'd panic without MFC or STL.

      Most Java programmers on the other hand, writing server-side code (the main use for Java), develop on Windows and deploy on Unix. With zero code changes.

      Sure, Java has portability issues. But don't even pretend most C++ code is more portable.

      Incidentally, if you avoid platform, compiler and processor specific features, I suspect C++ is even more mind-bogglingly slow than Java.

      ~Cederic
      ps: plus compiled Java is portable, not just the source code, of course

    2. Re:Problem: Java not portable by jonabbey · · Score: 1

      <rant>Greatest common denominator, please. Least common denominator is a corruption of the english language. In mathematics, the least/lowest common denominator is always identity, or 1. That is, with any given samples, the lowest common denominator doesn't tell you anything at all. But if you have 33, 22, and 55, the greatest common denominator is 11, which does indeed tell you something.

      Lowest common denominator is a conflation of greatest common denominator and lowest common multiple. The fact that it connotates a low value rather than a 'great' value makes it a popular usage, but it's dead wrong.</rant>

    3. Re:Problem: Java not portable by Srin+Tuar · · Score: 1

      hrm, nice rant.
      "LCD" is certainly not a math term, no doubt.

      However, I think its meaning is logical in this context: Its not the least denominator, but the least value of the things being factored. If you simply apply least to the right object, it makes perfect sense.

      So its the common functionality of even the least implementation.

    4. Re:Problem: Java not portable by jonabbey · · Score: 1

      What's wrong with the mathematically appropriate GCD in that context?

      And the 'least value of the things being factored' is 1, again.

      It really doesn't make sense. It's just another antinomal drift in meaning, like the phrase 'i could care less' for 'i couldn't care less'. It's precisely wrong.

    5. Re:Problem: Java not portable by Anonymous Coward · · Score: 0

      It called language. It doesn't listen to Webster or Ivory Towers or ranting Mathematicians. It's meaning assigned to sound. It has been since we first started speaking, way before people had a clue what zero was, never mind GCD.

      If I understand it and 3 other people understand it, it's a done deal. Get over it.

    6. Re:Problem: Java not portable by Anonymous Coward · · Score: 0

      Not to mention the number of Windows programmers who'd panic without MFC or STL.

      What the fuck does the STL have to do with Windows? Do you even know what the STL is?

      Incidentally, if you avoid platform, compiler and processor specific features, I suspect C++ is even more mind-bogglingly slow than Java.

      You really are an ignorant fucktard, Cederic.

    7. Re:Problem: Java not portable by Anonymous Coward · · Score: 0
      I like the way you've obscured your email address: no email harvesters will ever be able to figure out that your email is:

      slashdot@uglyfatguy.org or linked up:

      slashdot@uglyfatguy.org

      very clever sir!

    8. Re:Problem: Java not portable by 2short · · Score: 1

      "Not to mention the number of Windows programmers who'd panic without MFC or STL."

      Well, I'm a (mostly) Windows programmer, and I wouldn't panic without MFC (which I mostly avoid anyway). As for STL, since it has nothing to do with Windows, why should I be without it?

      "Incidentally, if you avoid platform, compiler and processor specific features, I suspect C++ is even more mind-bogglingly slow than Java."

      Well, I suspect you are wrong. C++ (when well written) is fast because it doesn't force on you any time consuming features that you don't want, and because the compiler can use various platform/processor specific features more effectively that with some other languages.

      "ps: plus compiled Java is portable, not just the source code, of course"

      Bytecode may be portable, but it still needs to be compiled. It is really just another level of source.

    9. Re:Problem: Java not portable by Mybrid · · Score: 1

      Hi!
      I agree. Java is not cheap to upgrade. Porting Java code to J2EE and its EAR and WAR files was very expense. Porting Java code to library upgrades is very expensve. Not to mention that Java has been tied to the HIP with XML and JSPs which are really hard to maintain.

      Java has traded portability expense for a hardware platform with portability expense with version upgrades.

      I've seen Java JDK version upgrades cost 3 times more than C/C++ ports to other platforms.

    10. Re:Problem: Java not portable by shish · · Score: 1

      > avoid platform, compiler, and processor specific features

      which leaves you with this --> stdio.h

      I have yet to find a program of greater complexity that "hello world" that didn't require some hacking to get to work cross platform. Some things work sort-of OKish by using configure & friends, but they're making changes to the code.

      And IMHO,

      #ifdef __LINUX__
      (one program)
      #endif

      #ifdef __WIN32__
      (another program, which does the same thing)
      #endif

      doesn't count as portable code

      --
      I mod down anyone who says "I will be modded down for this", regardless of the rest of their comment
    11. Re:Problem: Java not portable by shish · · Score: 1

      Unix isn't an acronym, it was only ever in uppercase because the guy who invented it had just finished a new smallcaps function in his print formatter and wanted to try it out

      --
      I mod down anyone who says "I will be modded down for this", regardless of the rest of their comment
  115. -1 Bigot by Anonymous Coward · · Score: 0
    But what about type safety? Java has no generic typed containers, like the STL.
    It will when Java 1.5 is released later this year (beta is already available).
    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.
    What has this got to do with anything? If you want safe code you really want to avoid C++ and use GC (buffer overflow anyone?).
    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.
    You must be using some weird version of C++ if it can guarantee how long functions will take to execute.
  116. Slashdotted by ReadParse · · Score: 4, Funny

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

    RP

  117. 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.

    1. Re:Performance not important? Umm , not quite... by thebatlab · · Score: 1

      Well car engine management system performance is a pretty small fraction of all software written don't you think?

      In a lot of cases time to market is more important than time to write 10000 bytes to a file. One extra second, no big deal. One extra month to hit that market and there goes some profit margin.

    2. Re:Performance not important? Umm , not quite... by Viol8 · · Score: 1

      ANy realtime control system that requires fast reactions at exactly the right moment hundreds or thousands of times a second
      will require assembly code to do the I/O. You can't rely on interrupts and some fat ISR written in a high level language to suffice. And that sort of software accounts for a lot of systems.

    3. Re:Performance not important? Umm , not quite... by matfud · · Score: 1

      You are not correct. Performance is a cost consideration in these situations. Predictability of code execution time is the requirement. Performance just changes the cost of deployment. (ie do I need a 20Mhz proc v's a 10Mhz proc, Do I need 64K of ram or 32K). For example, there are real time java implementations. They meet the RT requirements however the, perhaps, increased cost of deplying them may be the deciding factor. Many embedded systems have very tight unit cost limits.

      matfud

    4. Re:Performance not important? Umm , not quite... by Detritus · · Score: 1
      Real-time does not mean "real fast".

      Real-time systems must meet hard, or in some cases soft, timing constraints. Determinism is usually more of a concern than raw speed. A high-level language may be appropriate if it reduces total system costs and development time.

      --
      Mea navis aericumbens anguillis abundat
    5. Re:Performance not important? Umm , not quite... by Twylite · · Score: 1
      hence a lot of these sorts of systems are still hand coded in assembler , never mind C.

      This is just plain wrong. Most vehicle manufacturers apply the MISRA guidelines for C for their embedded systems. These are intended to provide quality assurance and highly robust systems.

      The guidelines/rules actively discourage the use of assembly language except where necessary to inteface with hardware. It is much more difficult to develop robust assembly than robust C.

      The idea that assembly is significantly faster than C is also a myth, unless you have an exceedingly poor compiler. Compilers are good at micro- and macro- optimisation, and often choose better instructions and constructs than a developer. There are very few developers that dedicate themselves to complete familiarity with a processor architecture and its instruction set (without which you simply can't optimise efficiently).

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    6. Re:Performance not important? Umm , not quite... by Siener · · Score: 1
      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.

      Do you have any references to backup these claims? I for one seriously doubt that there are many of these systems still written in assembler.

      The thing that makes a system "real time" is not speed, but predictability. The program and operating system have to guarantee that a certain operation (e.g. handling an interrupt) will take no more than a specified time.

      Once you have things that are predictable, it is easy to speed it up using faster hardware which has become very cheap. What is the average price of a CPU used in an engine management system compared to the price of manufacturing the whole car?

      I also suspect that engine management systems these days are complex enough so that writing them in assembler is not a good idea. Assembler does not scale well for large projects. That has been known for ages. If you're interested go read up on the history of MULTICS (pure assembler) and UNIX. Guess who won.

  118. IO sucks pretty bad on Win32 it seems, surprise :) by Oestergaard · · Score: 1

    Same C benchmark as the OS news one, compiled with GCC 3.2.1 (older than the OS news version), run on an Athlon MP 1666 MHz:

    Compile options:
    gcc -ffast-math -fomit-frame-pointer -march=athlon-xp -O3 -o Benchmark Benchmark.c -lm

    Result:
    Int: 7390 ms
    Double: 5560 ms
    Long: 23070 ms
    Trig: 3150 ms
    I/O: 1420 ms

    Compared to their best I/O (VC#): 9900 ms

    On both their and mine systems, the file written and read is only a fraction of the size of the system memory - any decent OS will cache this file completely in memory.

    I'd like to know what kind of GCC they used - is that a Cygwin version or something? Their numbers are *extremely* poor compared to my much older GCC here.

    But hey, I cheated - I used an OS - probably the "OS" News people didn't think of that... Go figure ;)

  119. This test is bunk by Anonymous Coward · · Score: 0

    The benchmark just runs some math intensive functions in a loop. It really does not test how the compiler deals with complex 'if then' logic, or memory access (this is where Java gets hit pretty bad by array bounds checking). For example if you do something like this:

    int x[][] = new int[500][500];
    for (int i = 0; i 500; i++) {
    for (int j = 0; j 500; j++) {
    x[i][j] = i^j;
    }
    }

    You get burned by array bounds checking way more than the following (which is noticably faster).

    int x[][] = new int[500][500];
    for (int i = 0; i 500; i++) {
    int y[] = x[i];
    for (int j = 0; j 500; j++) {
    y[j] = i^j;
    }
    }

    Such a difference is an example of a 'language difference' between C and Java. Java's semantics for 2D arrays prohibits the compiler from optimizing this the way C or C++ might.

    It could have at least filled a 2D array with trig values and maybee done some stencil iteration.

    The I/O test is fairly weak as well, and may be reflecting differences in the compilers IO libraries and not the compiler itself.

  120. 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.

  121. Is Java like awk? by emil · · Score: 1

    This has probably been discussed ad infinitum, but let's compare Java to awk and perl.

    awk is a fun little language, very portable. awk was supplanted by perl, however, mainly because perl allowed access to a much larger subset of the kernel API than did awk.

    I don't use Java much, but it seems to me that Java's great failing it that it doesn't allow (easy) access to system calls. If I want to stat a file, open a fifo, etc., I am forced to either link in C code with JNI, or use something like system(). Perl had no problem in being a little more platform-dependent, and I think it served them well.

    I wonder if this aspect of Java will ever change, and we might see kernel-specific sections of their standard library. But then again, I don't keep up with Java as I should, so perhaps we have this already.

    1. Re:Is Java like awk? by aled · · Score: 1

      Comparing awk and java doesn't have any sense (pears and apples). Platform specific is not the objetive of java and neither replace perl. In fact java intents to be very portable, but nobody says that it will be whatever everyone wants it to be.

      --

      "I think this line is mostly filler"
  122. 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.
    1. Re:Cost of Hardware vs. Cost of wetware by gregfortune · · Score: 1

      Exactly. Google is probably a good enterprise example where throwing hardware at a problem rather than a bunch of programmers and complex algorithms can provide an effective result.

      And for those of us who aren't writing enterprise apps, labor cost is King. When the application is a GUI front end used in a small/medium sized business, the cost effectiveness of a language like Python is amazing even when used on 5 year old machines.

    2. Re:Cost of Hardware vs. Cost of wetware by Clod9 · · Score: 1
      > ignoring the cost of the coder is wrong.
      Ignoring the SKILL of the coder is also wrong. In my professional experience, the compiler/runtime environment is chosen for reasons other than performance: upfront cost, installed base, pro/anti-Microsoft sentiment, many others.

      More importantly, performance and scalability problems of the applications have always resulted from a poor choice of methods and algorithms, not by poor raw numeric performance. Using C to double your performance cannot save you when you should be storing your data in binary instead of XML, or when you store your JPEG images in the database instead of the filesystem.

      I'm not saying XML or database BLOBs are the wrong choice for any particular application, instead these are real-world cases I've observed where performance problems could not have been headed off by choosing a different language. In fact I've NEVER seen a case where the language caused a performance problem, except in cases of sheer ignorance. Skill is worth more than either the "right" language or more MIPS.

    3. Re:Cost of Hardware vs. Cost of wetware by Brento · · Score: 1

      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).

      Sure, but who's going to install 20 to 100 new PC's? Remember, you'll also need another piece of wetware (a network engineer) to move everyone's data from the old PC's to the new PC's, so your argument is less powerful.

      --
      What's your damage, Heather?
  123. Open you eyes, the world is not about Internet. by Saeed+al-Sahaf · · Score: 1

    Database aside, you're talking Internet -- web servers, ftp servers, and so on. And games (quake) don't count. Contrary to what many of the "developers" that hang out here may think, the computer application world does not revolve around internet. There are many many more applications out there like the software that runs a manufacturing process or the 911 call center. If I work in a steel mill and the process is controlled by Windows based apps, it makes sense to use a Windows optimized language.

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    1. Re:Open you eyes, the world is not about Internet. by Foofoobar · · Score: 1

      That's not just internet. Oracle does not require a network connection to function. And the list goes beyond that; Photoshop, Flash, Illustrator, all work on Mac and Windows.

      And to point out error in your argument, if you work in a steel mill that uses Windows, and you use windows apps, SQL server and build windows tools using Windows own language. That's swell and good. But many companies have lost millions just for doing that.

      An example: When Code Red, Nimda and SQL Slammer hit in under 6 months time causing companies to lose massive amounts of information, their IT departments to crash and costing them millions. Many decided that they had enough and decided to switch. Some switched merely off of SQL Server while others switched off of Windows altogether. But because windows apps are not cross platform, they ended up having to spend millions trying to replace their infrastructure.

      Now, let's say that steel mill decides they want a Linux server to handle things now. Those scripts are more than likely not going to work. You will have to recode them in another language.

      Your development, infrastructure and so on all need maximum flexibility and maximum amount of options for success. But the more you limit those options, the greater chance you will paint yourself into a corner with no options left.

      As an IT person, you will always want the maximum amount of options and by coding in a language that is not ready for the market yet, limits your options... both as a developer and as a business.

      --
      This is my sig. There are many like it but this one is mine.
    2. Re:Open you eyes, the world is not about Internet. by Saeed+al-Sahaf · · Score: 1
      That's not just internet. Oracle does not require a network connection to function. And the list goes beyond that; Photoshop, Flash, Illustrator, all work on Mac and Windows.

      Yes, all these apps work on different platforms, but I'll bet under the hood, each version has been optimized with specialized tools for a specific platform.

      And to point out error in your argument, if you work in a steel mill that uses Windows, and you use windows apps, SQL server and build windows tools using Windows own language. That's swell and good. But many companies have lost millions just for doing that.

      You miss the point. If you are building for Windows, it makes since to use a Windows optimized language. And, the statement that companies have lost millions using apps like SQL Server is tenuous at best, it's a sweeping statement that really does not mean much nor have any particular facts to back it up. Lost millions in what way? Again, you focus on the internet. Not all (in fact, very few) Windows apps are related to the Internet, or even on a machine attched to the internet.

      An example: When Code Red, Nimda and SQL Slammer hit in under 6 months time causing companies to lose massive amounts of information, their IT departments to crash and costing them millions.

      Again, Internet. The software in my imagenary steel plant run on machines that are not connected to the Internet. Also, stay tuned, as Linux use grows, so will virus attacks targeted at Linux / Open Source.

      Many decided that they had enough and decided to switch.

      Not really, though they should switch. Numbers, please. It hasn't happened yet.

      Some switched merely off of SQL Server while others switched off of Windows altogether. But because windows apps are not cross platform, they ended up having to spend millions trying to replace their infrastructure.

      Can you show this to be so? No, not very many "enterprise" companies have dropped SQL Server. And, as we all know from the heated battle Linux is having getting into "enterprise", we do know that not very many large operations have switched yet, so there have not yet been "millions" spent on re-tooling.

      Now, let's say that steel mill decides they want a Linux server to handle things now. Those scripts are more than likely not going to work. You will have to recode them in another language.

      Yes, and if they decide to switch to BeOS, they will have to recode too. But it is very rare that manufacturing code is not distinctly tied to a specific hardware profile. Indeed often, it's all proprietary. It is unlikely that a manufacturing process would just up and decide "gee, I wan't to use a different OS". It doesn't work that way.

      By the way, I mostly work with Linux based apps, but I'll use whatever is best for the job

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    3. Re:Open you eyes, the world is not about Internet. by Foofoobar · · Score: 1

      >>Yes, all these apps work on different platforms, but I'll bet under the hood, each version has been optimized with specialized tools for a specific platform.

      Do not confuse the tool and it's end use. These tools can be used on various platforms and their code can be geared towards various platforms. But most software developers build one codebase and then tweak it for each OS. So rather than recoding the entire thing, they merely have to tweak the code for each seperate OS. It's cheaper and easier.

      >>Can you show this to be so? No, not very many "enterprise" companies have dropped SQL Server. And, as we all know from the heated battle Linux is having getting into "enterprise", we do know that not very many large operations have switched yet, so there have not yet been "millions" spent on re-tooling.

      Yes actually. Though you can do your own research if you are truly curious, many have reported that 15%-30% of companies running SQL Server switched after Slammer hit within 6 months. Don't believe that people have switched? Take a look at Ntecrafts stats for the last year and look at IIS (yes internet). You will see how many people have started to dump IIS and one can easily conclude that Microsoft has been dumped as well.

      Recent reports list Linux as having a 33% server market share while MS has 23%; Microsoft makes a great deskop but a lousy server.

      So again, you can say this is internet based. Well what isn't in a company these days. Web services has been high in demand since the 90's and still is to this day. People on the move want info on the move and you can't have that on a server you cant communicate with

      But this is a dodge. I made the point and showed several software programs that do not use the internet but are used on various platforms. Fact remains: develop for one platform, be crippled by your dependency.

      The more you limit yourself and your company, the more you limit your options. IT departments live and die by their options and those who paint themselves into a corner and have run out of options often spend millions trying to get out.

      If you support this kind of mentallity, then I pity the company who you are painting into a corner.

      --
      This is my sig. There are many like it but this one is mine.
    4. Re:Open you eyes, the world is not about Internet. by Anonymous Coward · · Score: 0

      Look, porting sucks and costs big no what OS you start on or end up on. It'd cost just as much to start with linux and port to windows. But I tend to think you are passionate about this because you think that if a system is written to run under windows that it's simply going to have to be made to work under linux at some point in time. Which, I hate to break it to you, is anything but certain.

  124. 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.

    1. Re:Portable.net vs MONO by SlightOverdose · · Score: 1

      For comparison purposes...

      $ java -server Benchmark
      Int arithmetic elapsed time: 9806

      $ java Benchmark
      Int arithmetic elapsed time: 14404 ms

      $ ./c.benchmark
      Int arithmetic elapsed time: 6950 ms

    2. Re:Portable.net vs MONO by Anonymous Coward · · Score: 0

      you should also try
      mono --optimize=all Benchmark.exe

  125. What a shock by NDPTAL85 · · Score: 1

    Is it any surprise that Java is so slow?

    --
    Mac OS X and Windows XP working side by side to fight back the night.
  126. You do realize... by Ayanami+Rei · · Score: 1

    That runtimes less than one second long, and programs that are small enough to sit in cache are probably not good indicators of true compiler performance. Even if you ran those tests 100 times, you are too close to the timer interrupt resolution to get any meaningful results.

    Try filtering up to 100M, at least (I can't think of any way to use the cache less efficiently that isn't trite).

    --
    THIS THING CAN TURN ON A DIME, MACROSSZERO STYLE ALSO FUCK BETA, ~NYORON
  127. Distributed optimization by sleepingsquirrel · · Score: 1
    Consider what was done years ago with assembly. The performance was incredible, and the amount of superfluous garbage in the code was minimal.
    In this age of distributed everything else, why aren't we doing distributed complier optimizations? Take a large open source app like mozilla (or your favorite). I wonder how much closer it could be to hand crafted assembler if there were 100,000 volunteers using their computers idle time help optimize it. Anyone know of a compelling reason why this wouldn't produce much tighter code?
    1. Re:Distributed optimization by matfud · · Score: 1

      You mean distribute something like this
      GNU super optimizer

      http://www.programmersheaven.com/zone3/cat35/791 .h tm

      matfud

  128. python int benchmark is junk by Anonymous Coward · · Score: 0

    Look at the code for the python benchmark. Notice that the value for intResult will overflow to a long (ie arbitrary precision integer) when the value of i exceeds 100,000. Most of the "int" benchmark is being done with python longs.

  129. 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.

  130. Missing memory testing by bratmobile · · Score: 1

    Integer and floating point math are really very similar, between native compiled languages (like C/C++) and managed languages (like Java/C#/VB.Net/etc.).

    This benchmark really isn't very useful, at least as a comparison to see if managed languages are "ready" for real development work.

    A much better benchmark should include realistic use of dynamic memory allocation (free/malloc vs. new/gc), arrays, etc. This is where managed/unmanaged languages really crucially differ.

  131. Language / Runtime distinction by peterpi · · Score: 1
    "found Java to perform significantly worse than C on Linux/Athlon."

    I know it's petty, but... ;)

    You found your particular combination of compiler and Java Virtual Machine to perform significantly worse.

    Native compilers and (to a lesser extent) JIT compilers could eventually be written that make the speed different negligable. Perhaps they already have been; It's been nearly 3 years since I coded in Java. :)

  132. 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?

    1. Re:Not a fair test - Frame Pointers by gatkinso · · Score: 1

      -fomit-frame-pointer will cause lots of goofiness on Cygwin. Perhaps this is why he omitted it.

      However, he probably should not have omitted them for VC++ in that case.

      Howeverhowever, VC++ will optimize them away anyway in most (many? some?) cases.

      Howeverhoweverhow... ok that is getting stupid... I have run many benchmarks comparing sources built on gcc and VC++ on the same machine (dual boot RH Linux 9 gcc 3.3.1 and VC 7.1). VC++ generally beats gcc across the board, even runnin unoptimized code aganst gcc optimized.

      --
      I am very small, utmostly microscopic.
    2. Re:Not a fair test - Frame Pointers by Anonymous Coward · · Score: 0

      HAHAHAHA. Nice troll.

  133. AWT/SWT performance by Anonymous Coward · · Score: 0

    AWT has terrible architecture and consists of heap of fixes sitting on top of the original JDK 1.0 quick and dirty API.

    SWT is AWT done right, has very reasonable architecture and API that does not force to create zillions of objects to perform basic GUI operations. This leads to better performance especially noticeable on less powerful computers.

  134. Re:IO sucks pretty bad on Win32 it seems, surprise by Compenguin · · Score: 1

    Actually he used very agressive CFLAGS for VC++ but much more passive (but still agressive) flags for gcc.

  135. 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
    1. Re:Consider the logic... by Anonymous Coward · · Score: 0

      This from the guy who brought back whitespace as a syntactically sensitive element. Please. 20,000 is an ass-pulled number. We maintain more easily. The factors are also bs, it all depends on what libraries you're using how much abstraction you've done, etc.

    2. Re:Consider the logic... by Twylite · · Score: 1

      van Rossum makes the error of assuming a program is a single entity, rather than a collection of components with properly defined interfaces.

      A 100,000 line program comprising 19 components of 5,000 lines each, all having a well-defined interface, and a 5,000 line application to bind them, is easily maintainable, even by a single developer.

      Complexity increases dramatically as the number of line per component increase, but slowly as the number of components increase. It is a misnomer to judge overall complexity on the total SLOC when you have a highly modular system.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  136. ICC vs GCC default compilation options by Anonymous Coward · · Score: 0

    When comparing ICC and GCC one has to take into account
    that they have very different compilation defaults.

    For floating point code ICC defaults to non-IEEE
    floating point mode, whereas GCC is IEEF FP compliant
    by default. In IEEE mode a lot of FP optimizations
    CANNOT be performed, trigonometric x86 instructions
    cannot be used, etc. So for a fair comparison
    GCC needs the -ffast-math flag added.

    Also GCC needs -fomit-frame-pointer, ICC does not
    generate a frame pointer by default.

    Doing and ICC vs. GCC comparison without taking
    the above issues into account is plain silly.

    BTW, no version of GCC supports pipeline scheduling
    for Pentium4! If anybody at Intel reads this
    maybe is time to write that code for GCC, it's
    not that hard, a few days of work.

  137. OT: Re:They should benchmark development time by Jerf · · Score: 1

    Perhaps it would be more correct to say that OOP is a SB when realized by a language like Python (it definitely isn't w/ C++ and Java).

    Actually, over the past year or so I've come to the point where I also believe this. The advantages of OO promised in the 80's are just now materializing... ... but only in very small handful of languages, mostly Python and C++ in the hands of a true expert. (I'd bet ruby qualifies but I've never used it, and Perl can qualify but you end up needing to implement good object semantics on your own, which is both good and bad. Of these languages Python probably has the lowest barrier to entry for the maximal OO power.)

    This fact is largely going unnoticed, but it'll probably penetrate the mainstream here in another five years. I sure hope so ;-), programming in Python is so much less frustrating then other langauges. A lot of people have a lot of unlearning to do before they can realize the benefits.

    Python with good OO in the hands of a competent person magnifies their power almost beyond belief. I'm building an innovative application in Python, have been over the last year or so, and I wouldn't even be a 10% as far as I am now in C++. I am easily matching the output of a full-time 3 or 4 man C++ team in my spare time with Python. Once this really cranks up in the mainstream I expect to start seeing some real differences in programs.

  138. Trig functions require function call by mofochickamo · · Score: 1

    Perhaps Java 1.4.2 is slow in the trig section not because of a bad trig implementation, but because of how it makes function calls.

    --
    Honk if you're horny.
  139. DirectX is a thin layer... by tizzyD · · Score: 1
    Just above direct hardware calls anyway. DirectX bypasses so many subsystems in Windows, it's should not be called a Windows API. It's a Glass API. That's why there are so many bugs in DirectX all the time, forcing Windows users to constantly create patches to their drivers. The more exposed to the hardware and the lower the level of programming, the more likely silly bugs will kill you. But you get incredible performance.

    Now, I agree that I would not go back, but realize that you still depend upon someone out there, writing fairly low-level hooks for the DirectX calls in the GPU to get the performance you want. Yep, someone's still hacking assembly out there.

    But in the end, for most business apps (the kind that care about whether you're using java, c#, dot net, or the langue du jour), it's not about DirectX. It's about cost.

    --
    ...tizzyd
  140. 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
    1. Re:Coming in 1.5, but you can do this now by Bob+Davis,+Retired · · Score: 1

      Wait, is Java 1.5 really Java 2 or Java 3?

      Fucking Java.

  141. Improving performance. by nuggz · · Score: 1

    Yes, but if I get mine done today, and you don't, you can't compete with me because you aren't there yet.

    I get first crack at the market, by the time you catch up I could already be improving my performance by rewrite critical portions in a higher performance language.
    Then not only do I end up with your same performance, but I got into the market first.

  142. Bzzzzt. Wrong. by Anonymous Coward · · Score: 0

    That's why your

    OS
    Word processor
    Browser
    Mail Client
    Terminal emulator
    Shell
    Spreadsheet
    Image Editor
    et fucking cetera

    are written in C/C++

    Speed matters.

    It's +5 Funny that *you* don't take it seriously.

    Sincerely,
    C-Zealot

  143. 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?

  144. Why so few languages? by Ed+Avis · · Score: 1

    The Great Computer Language Shoot-Out compares many more languages in a variety of benchmarks, although it doesn't have C# yet. The key thing to note is that high-level compiled languages like ML or Scheme perform slower than C, but much much faster than interpreted scripting languages like Perl.

    --
    -- Ed Avis ed@membled.com
  145. amen by b17bmbr · · Score: 1

    if written well, swing is a very good toolkit. i did a few (unscientific) tests, and discovered that the better way to use swing was not use multiple subclasses of the widgets rather than having one big class. write anything you need in the constructor, and put the methods i nthe subclass. also, if you use threading with swing, you'll notice a huge increase in performance. but that is not the easiest thing to code, and people would rather let the IDE do it for them. i don't kow.

    --
    My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
  146. But is it worth it... by tizzyD · · Score: 1
    It would produce incredible code. On the other hand, such optimization and performance tuning is a lost art. I've known very few programmers who are great debuggers and optimizers. I generally see three types of engineers:
    • seeds (people who can create new approaches quickly, grasp lots of ideas, but cannot fine tune or produce solid code to save their lives),
    • coders (people who need more structure around the problem, but can methodically solve it and produce good code), and
    • polishers (people who are so detail focused and methodical that they can structure tests, analyze inputs, and find needles in haystacks)
    Sadly, the last group seem to be disappearing, where instead we throw batches of Bangalore and Indian engineers or automated test tools at the app, getting it to meet the thresholds of the business spec, and then we move on.

    So, for something like Mozilla, the performance to cost is not the main business driver. If it takes 1 sec to show a web page vs. 0.5 sec, most users simply don't care. Thus, the cost relationship.

    --
    ...tizzyd
  147. Re:Speed? No. Stability. Yes by Anonymous Coward · · Score: 0

    Generics, *NOT* templates are coming Tiger (JDK 1.5). There is a difference.

  148. java -server usually yields worse benchmarks by juancn · · Score: 1

    From the poster's benchmark:

    The Java code was compiled with J2SE v 1.4.2_03 javac -g:none and executed with java -server

    It's my experience that the kind of optimizations that are applied when the -server JVM option is enabled usually slow down the benchmark.

    The client VM is usually faster on x86 machines.

    But I really don't know why.

    1. Re:java -server usually yields worse benchmarks by Anonymous Coward · · Score: 0

      Yes you're right in this case. A little known secret about a JIT JVM is that it doesn't compile a method until the code has been executed 1500 times on the client VM. And 10,000 executions on the server VM. So your code is interpreted for quite sometime before it is JIT'ed.

      Try it out by adding this option to your program: -XX:+PrintCompilation. You'll see when various methods are JIT'ed by the JVM.

      You can also adjust when your VM compiles a piece of code with -XX:CompileThreshold. Lower the threshold too much and you'll see long startup times.

      Read more about this interesting little nuiance here: http://www.javaworld.com/javaworld/javaqa/2003-04/ 01-qa-0411-hotspot.html

  149. Fanboys unite! by Anonymous Coward · · Score: 0

    Y35! L!n0X T0rV@lDz 1z teh rul3z h4xXh0r!!!1!

  150. 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)
    1. Re:Tried this with gcj 3.2, here are the results by sbrown123 · · Score: 1

      Were you running GCJ as interpreted (with GIJ) or compiled? Did you use GCJ with an optimized setting (-O2)? By default GCJ, unlike GCC, will include debug if you dont use an optimize setting.

    2. Re:Tried this with gcj 3.2, here are the results by __Reason__ · · Score: 1

      Try something like -O2 -ffast-math for your GCJ compile - this should improve the math scores significantly.

    3. Re:Tried this with gcj 3.2, here are the results by BreadMan · · Score: 1

      >> By default GCJ, unlike GCC, will include debug if you dont use an optimize setting

      Didn't know that. Thanks for the tip. :-) I compiled both again with -O2. gcc ran about twice and fast and the gcj compiled code just a bit slower. I good improvement for gcc and a huge one gcj.

      Execept for the I/O, and I would attribute that more to the classes, which add a whole bunch of overhead.

    4. Re:Tried this with gcj 3.2, here are the results by fxj · · Score: 1

      I tried the benchmark with the BEA WebLogic JRockit JVM on winxp and got the following results:
      bea java 1.4.1_05 61288 ms
      java 1.4.1_03 111380 ms
      java 1.4.1_03 -server 101807 ms
      c# 59593 ms

  151. 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
    1. Re:I just sped the Python version by 7x and 1.5x by dfj225 · · Score: 1

      Well, while the results published in the article may be useless in a scientific sense, if you had read the author's reply in the comments for the article, the results would prove to be somewhat useful. Here are his words:

      "For better or worse, tons of people code exactly like that. In my industry (IT consulting), virtually everyone does! It's absolutely routine to be given a programming task, a language, and an unrealistic deadline. You're expected to learn what you can from on-line help, whatever tutorials you can scrounge up on the net, and O'Reilly books, and cobble together code that works."

      After reading this, I can understand what approach he was taking.

      --
      SIGFAULT
  152. 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.

  153. Silver Bullet... by MosesJones · · Score: 1


    Every one who proclaims a Silver Bullet is doomed to be considered a fool.

    Sorry, but Brookes was right, there is no Silver bullet, and Python certainly is not it.

    1) BPM in Python
    2) Adaptor Strategies and Toolkits in Python
    3) Distributed Transactions in Python
    4) Clustering and Caching strategies in Python

    Java is irrelevant as a language, its the support and tools it has that makes it a good platform choice.

    --
    An Eye for an Eye will make the whole world blind - Gandhi
    1. Re:Silver Bullet... by ultrabot · · Score: 1

      Every one who proclaims a Silver Bullet is doomed to be considered a fool.

      Aren't you being a bit too dramatic? It's a slashdot signature, not a CS thesis project.

      Sorry, but Brookes was right, there is no Silver bullet, and Python certainly is not it.

      If you say so ;-).

      Java is irrelevant as a language, its the support and tools it has that makes it a good platform choice.

      Agreed. Java is a very mature platform, and a good, safe, conservative choice. It all depends on what you are doing.

      Python will possibly be the conservative choice in some years to come, we'll see. I'd like to see young people educated in Python and become agile developers who run circles around large teams of more conservative developers, thus dragging it into the billion dollar mainstream of Java, instead of the OSS mainstream it inhabits at the moment.

      --
      Save your wrists today - switch to Dvorak
  154. Re:"They"? "Someone"? by be-fan · · Score: 1

    Someone has to be *really* comfortable with C++ to get the benefits of it. Especially, you have to forget all your standard C/Java techniques and embrace modern C++. Once I let go and just started writing code that naturally flowed around the STL, my productivity went up enormously. I constantly see myself doing things that just wouldn't be possible in Java. For example, I was writing a wrapper class for a C data structure. I didn't want to write and maintain a whole bunch of get/set methods, but I didn't want to make the variables public. So I just wrote a dozen-line template to auto-generate the get/set methods for me, and that was that.

    On the other hand, C++ is still a very irritating language at times. Its biggest problems are:
    - Hairy syntax (a little bit better in Java)
    - Complex template semantics
    - The need to have to deal with "classic C++" interfaces
    - Lack of advanced features like lambdas, type inference, etc.

    --
    A deep unwavering belief is a sure sign you're missing something...
  155. .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.

  156. WHERE THE HECK IS OBJECTIVE-C? by tyrione · · Score: 1

    When it's the foundation of Cocoa can anyone tell me how come this wonderful language isn't in the competition?

    1. Re:WHERE THE HECK IS OBJECTIVE-C? by Anonymous Coward · · Score: 0

      No one knows it.

      5% market share and falling.

    2. Re:WHERE THE HECK IS OBJECTIVE-C? by rafimg · · Score: 1

      Actually, Objective-C is converted to C during preprocessing. [object method:var1 with:var2] gets converted to something like objc_msgsend(object, msg1, var1, msg2, var2). Obviously, the whole message sending business is going to be slower than regular function calls, but that really just means that more code is being generated and not that the compiled code is "slower." In fact, since Objective-C is a strict superset of C, you can write and call plain old C functions and pass them to cc1obj, which will output the exact same code as cc1.

  157. What? No SPL? by Ahotasu · · Score: 1


    It saddens me greatly that they failed to consider the Shakespeare Programming Language (/. story here ) worthy of inclusion in their performance tests. *sniff*

    Granted, since SPL eventually becomes C, the C scores would apply, but still...

    :-)

    --
    --- Standard disclaimer applies.
  158. Time spent in other places by Anonymous Coward · · Score: 0

    I find that with C++ you spend a reasonable amount of time finding buffer overflows, with Java you don't have that problem.

    However, you spend much more time configuring BEA, the jar files, misc crap like that.

    I've been writing in Java for years, and C,C++, etc. even longer. But I've switching back to C and really liked it.

    Now if I need a server I can dumpster dive and get a Pentium 200 MHz with 64 MB ram. After installing Slackware I have a great machine!!!

    With Java the overhead and bloat would slow it to a crawl. But with C, my server runs very well- even under heavy load.

  159. Re:IO sucks pretty bad on Win32 it seems, surprise by Oestergaard · · Score: 1

    On the same machine, with no optimization at all to GCC, I get:

    Compilation:
    gcc -O0 -o Benchmark Benchmark.c -lm

    I/O: 1590 ms

    Almost the same. Clearly, the thing that takes time is the system calls.

    If he used Cygwin GCC it's no wonder that it sucked. But my results are still about an order of magnitude better than (optimized!) VC++ and C#.

    Anyway, this comes as no surprise to me. System calls on Win32 stink - their performance as well as the raw API.

    Yes, I spend too much time getting things to run fast on that platform - I have my scars - this is just an opportunity to rant about it ;)

  160. Yea, No Memory Access by jetkust · · Score: 1

    Yea its definately not a comparison on languages. Its more a test on compilers. Problem is it ignores the different ways these languages access memory, which can have a more severe effect on performance. Java and C# have well optimized bounds checking and garbage collection, but there are still circumstances you may come across where these bytecoded languages cannot optimize memory access to the speed of C. Sometimes overhead just can't be avoided.

  161. Leave it to the machines... by sleepingsquirrel · · Score: 1
    I've known very few programmers who are great debuggers and optimizers.
    Maybe I wasn't clear in my original post. I want the _machines_ to do the optimization. Someone writes a special version of gcc (the -fbeowulf-cluster option) which takes advantage of the vast computing resources of clients on the 'Net to do optimizations that would otherwise seem infeasable.
    1. Re:Leave it to the machines... by Anonymous Coward · · Score: 0

      GCC's problems doing optimizations are not due to lack of CPU resources.

      Furthermore, I think Mozilla is a good example of software that's slow by design -- it's providing this huge middleware layer just to make front-end development faster. If you really wanted to make Mozilla faster, you'd throw out 90% of the code and start over, not tweak the compiler.

  162. All fine, and excellent, and wonderful, but... by Anonymous Coward · · Score: 0

    All fine, and excellent, and wonderful -- and it really surprised me Java could be so fast. Guess I was wrong about it. I took a mental note to compare Java and Python as my next language...

    BUT, I was more interested in compile times (because these affect development tremendously). Does anyone know about one such benchmark? Please have in mind I don`t have the slightest interest in execution times... thanks in advance for any hint.

    BTW, I may do it one day, but right now I lack the time...

  163. Why? by Anonymous Coward · · Score: 0

    why, when cornered, do Javaphreex start
    shouting "bigot" ???

    you are like apple and kde zealots.

  164. 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
  165. Linus said it best:: 640K is enough for everyone by Anonymous Coward · · Score: 0

    Yes, let's give Torvolds credit for every corny computer industry cliche

  166. so you write everything in assembler? by acomj · · Score: 1

    So you get the maximum performance out of every program. You want it when?
    There is a fine line between raw performance and the time required to code. If I'm first to market with a slower product I'm at an advantage. If it cost you 10X as much to code your much optimized solution I'm still at an advantage provided hardware is fairly inexpensive compared to programmer time.

    Perl programs write really fast code because they tend to use hashes more than c/C++ programmer. Perl isn't compilied.

    Its not as simple as you make it seem.

    1. Re:so you write everything in assembler? by konmaskisin · · Score: 1

      "Perl isn't compilied."

      Yes it is ... every run of the "interpreter" compiles the perl script or code and then executes it. One can even create stand alone executables for various platforms ...

  167. Re:java vs C by TheRaven64 · · Score: 1, Flamebait
    people who say "but oh it's compiled it runs just as fast" haven't a clue what they're talking about.

    This comment alone marks you as a troll, but I'm bored so I'll reply to you anyway.

    Java isn't and never will be as fast as C/C++

    This is pure nonsense. JIT compiling is one of the most exciting research areas in practical computer science at the moment. With a pre-compiled program, written in a static language such as C or C++ the compiler has only one shot at optimising it and has to do so with no knowledge of the data on which the program will be executing.. With a JIT compiled program, it is possible to continue to optimise the code as it runs. This means that the code will be slower the first time it runs, but (theoretically at least) will get gradually faster over time. An analogy for this would be the difference between defragmenting your hard drive once at boot time, which will give you a one-shot performance boost, and dynamically re-allocating files so that the most used ones are on the fastest parts of the disk, which gives you a performance hit at first but then a gradual performance over time as the system optimises your disk.

    --
    I am TheRaven on Soylent News
  168. of course sun jdk is slow by Anonymous Coward · · Score: 0

    first, it's a reference implementation. second, sun spends far more time optimizing hotspot for sparc solaris than x86 linux. why? because ibm and bea do x86 linux so much better. this isn't a useful benchmark until it includes either ibm or bea jvms.

  169. Python results are worthless by Anonymous Coward · · Score: 0

    Unfortunately, the author compiled python using cygwin, which is extremely *slooooow*. Why on earth he chose to download the python source and compile it under cygwin instead of using the windows binaries provided on python.org that the rest of the world uses remains a mystery. Based on the same false premises that lead gentoo users to compile night and day, perhaps? ;)

    It is also misleading that python is often referred to as "fully interpreted" (often several times in one sentence) and compared to "semi-compiled java". Python is byte compiled, just like java.

    As a programmer who uses python almost exclusively, I have rarely have need to optimise, although I have written a few C extension modules (which is fairly simple), and occasionally used psyco (which is trivial, and in my experience has almost always resulted in a big increase).

    Python is slower than the languages tested in many situations, but the results of this particular benchmark aren't worth the electronic paper they're printed on. Oh well, it's pretty damn hard to compare language speed, I guess Christopher guy did his best.

  170. String, list, dictionary, and function benchmark? by Anonymous Coward · · Score: 1, Interesting


    Almost all my work programming is function calls and string, dictionary, and list manipulations in a single and multi-threaded apps. A little integer, very little float (money), no trig. In this case the only useful benchmark in the article is I/O.


    My guess is that a majority of programmers aren't developing apps heavy in integer, float, or trig. So this benchmark article suggest that we not develop the next iteration of Quake in python.


    Does anyone know of a multiple language benchmark relevant to the rest of us lumpen proletariat programmers?

  171. java is slower than c by Suppafly · · Score: 1

    news at 11.

  172. bla bla bla by Anonymous Coward · · Score: 0

    Yes, performance might be important, but then, many times it is completely irrelevant. I started out with a C64, Amiga, 286, 486, P60, ... uhh, i actually have to check to find out what processor I am currently running: Athlon 2400. I couldn't care less how fast todays machines are, as it is fast enough for 99% of my tasks.

    Now my employer has lots of transactions to process etc., still we are using Java, and not for performance reasons.

    But what I, my employer, and 99% of the developers care for is time to market. Because that means money, more free time etc. Always. Humans can do something else while waiting for the machine to spew out some results. If you don't have enough time, most of the time buying faster hardware is an option. A team next to ours bought new hardware for CHF 2 mio as their app was too slow for the original hardware. So who cares, development cost was something like CHF 8 mio. Without having the app ready, an annual CHF 100+ mio business (revenue) would have been severely crippled.

    So tell me which language needs the least lines of code and has the most useful libraries for reuse.
    My guess is python, ruby, smalltalk and lisp might be some very productive languages. Java, C++, Perl might have huge libraries attached to them.

    I am sick of these language performance comparisons! Tell me which language to use to save precious development time.

  173. 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.
    1. Re:Microsoft's trig "functions" aren't by r6144 · · Score: 1

      I agree with your post in general, but I want to clear up some misunderstanding in your post.

      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.

      Such code is usually very inefficient, because a series of calculation opcodes without stack operations in between probably has to be executed serially (most forms of x87 calculation opcodes store results in st(0) which is used by the next one, although other forms do exist). In contrast, stack operations (such as FXCH) are very cheap (especially since they are often executed by a different execution unit from the one doing the calculations), and proper use of them can often enable instruction-level parallelism, which may double or triple performance, since the latency of many instructions are two or three times higher than the throughput.

      No decent compiler (which is almost everything we currently use) should generate such serial code when optimizing for Pentium or better, if they are allowed to do otherwise according to the standards. Probably there is something wrong within your source code. For example, IIRC the compiler is often not allowed to change the order of calculations in certain ways, even if they are mathematically correct, according to IEEE specs, so you may have to specify the order explicitly in the source code.

      As other posts have explained, instructions like "FSIN" and "FCOS" are not exactly standards compliant, so if they aren't used, most probably the compiler are just not allowed to use them --- it's up to you to tweak some switches to tell it that such instructions are allowed.

      BTW, gcc is stricter on this by default, so you can often hear people say "gcc-generated code is very slow" when the fault lies within their code / switches which prevents much optimization to be done.

    2. Re:Microsoft's trig "functions" aren't by Anonymous+Brave+Guy · · Score: 1
      Such code is usually very inefficient, because a series of calculation opcodes without stack operations in between probably has to be executed serially [...] In contrast, stack operations (such as FXCH) are very cheap [...] proper use of them can often enable instruction-level parallelism, which may double or triple performance, since the latency of many instructions are two or three times higher than the throughput.

      Yes, I knew that, thanks. I imagine Microsoft's optimising peeps know that too, hence the calculation instructions scattered through the stack set-up code that I mentioned and my use of the term "neatly co-ordinated". I don't know if their instruction order really is optimal; I imagine it's not perfect. But as I said, IME they do a better job than most of taking advantage of the FPU.

      As for the Intel FPU FSIN/FCOS issue, yes, I'm painfully aware of that, too. When you run high precision automated numerical tests, as we do, such errors can really spoil your day. Numerical analysis can be tedious at the best of times, but when the basic instructions on your FPU introduce such massive inaccuracies under adverse conditions, it really sucks.

      The issue of software emulation of those instructions goes far beyond the FSIN/FCOS bugs, though. Working to Java standards, there all kinds of 100% reproducibility requirements, where even the IEEE standards don't mandate that you get exactly the same answer on different platforms (due to round-up/round-down issues, for example). I can understand, and depending on circumstances would probably support, a serious math library providing software emulation for Intel FSIN/FCOS instructions to ensure decent accuracy. But those are two instructions, not the whole darn floating-point lib, and it's software emulation of the latter that produces the sort of bizarre results we're seeing in these benchmarks.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  174. Maestro by milsim · · Score: 1

    I'd like to see Meastro using SWT, it'd be heaps faster. But... is Java3D "compatible" with SWT?

  175. 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

  176. 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

  177. Come on by Sanity · · Score: 1

    So you have found one example where Python is more efficient, I could easily provide examples which demonstrate the opposite, it proves nothing.

    1. Re:Come on by PostItNote · · Score: 1

      I could easily provide examples which demonstrate the opposite

      Please do, as I have never seen any, and I have looked. It really does seem that Python requires physically less code to accomplish the same task when compared to Java or C/C++.

      I did Java professionally for 2 years, and now I program python for research purposes in grad school, and I'm producing stuff more quickly than I could have with Java - and I have about 100 hours experience with Python and about 4000 hours experience with Java. So either there is a real difference, or the two languages are equivalent and I coincidentally became approximately 400% more efficient at THE EXACT SAME TIME I switched to python. (I estimate a factor of 4 improvement in my speed to goal)

      Rather than assuming that I magically got 4x better, I blame at least a little of it on the language.

    2. Re:Come on by Sanity · · Score: 1

      You can cite your personal experience, I can cite mine. The only way to settle the debate is to give skilled Python programmers and skilled Java programmers the same task to solve and see who finishes first.

    3. Re:Come on by PostItNote · · Score: 1

      And this was done here! They gave a certain task to a bunch of programmers in 1999 and they solved the program using many different languages and reported on how long it took them, etc. Results are really only valid for Java as it was in 1999 (but the same is true for Python as well). Check it out at: http://wwwipd.ira.uka.de/~prechelt/Biblio/jccpprtT R.pdf

    4. Re:Come on by Anonymous Coward · · Score: 0

      If you look at the "phonecode" task they were performing it was extremely simple. The value of things like strong-typing and contracts really only comes out in large-scale application development.

  178. Re:Speed? No. Stability. Yes by jemfinch · · Score: 1

    I'm not even a Java programmer and I can see your problem. You lack a quality testing methodology. If all you're doing are hand tests to assure yourself that your code is correct, I pity your customers, whether you program in C++ or Java or Python.

    Type safety alone (especially the faux "safety" you get in C++) is not an adequate replacement for a comprehensive testing methodology.

    Jeremy

  179. .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 :)

    1. Re:.NET is not Windows only by JohnnyCannuk · · Score: 1

      The only production version of .Net is on Windows.

      Considering Mono is at release 0.29 and DotGNU is at 0.1, that's the way it will be for a long time. I certainly hope they get to the point where they are comparable and compatible with .Net 1.1 on Windows, but not today and not soon. So, for all practical purposes, .Net is Windows only.

      Now, you can get production versions of the J2SE runtime and development kit for almost any platform and, despite what some people here say, really is "write once run anywhere" - much more so than any other language or platform.

      Even C/C++, when writing properly to standards with a separation of concerns so that cross-platform toolkits can be used or swapped out is more cross-platform than .Net is right now.

      So enough with the .Net propoganda. When Mono and DotGNU mature to production levels (2 years maybe?) or at least have Windows.Forms implemented, only then will .Net cease to be a Windows only platform.

      --
      Never by hatred has hatred been appeased, only by kindness - the Buddha
  180. 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.
  181. 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.
  182. Numbers and why not to use -fomit-frame-pointer by pantherace · · Score: 1
    On my own tests: p3-800 dual, 1.5GB ECC RAM, using this person's tests (compile lines) running gentoo linux, gcc 3.3.2 20031022, glibc 2.3.2(-r3), kernel 2.6.0-test11, My cflags are -O3 -pipe -march=pentium3 not including -fomit-frame-pointer, 1) for debugging, 2) see below :) I could recompile to test all of these fully but I don't want to be spending the next several weeks convincing people that on this particular benchmark -fomit-frame-pointer doesn't matter. All were run with the following command from KDE (cvs build) nice -n -20 ./Benchmark-c, oh and for the people who will attempt to tear this to shreds, they were only run once. Also I haven't yet emerged icc, because in the past I have found it to be more of a problem than a help. (To me anyway, your results are likely to differ).
    normal:gcc Benchmark.c -o Benchmark-c -lm
    OmitFP:gcc Benchmark.c -o Benchmark-c -lm -fomit-frame-pointer
    Optimized builds: (replace the X with the number(2,3) or symbol (s)) for example: O3norm:gcc Benchmark.c -o Benchmark-c -lm -O3
    OXnorm:gcc Benchmark.c -o Benchmark-c -lm -OX
    OXOmFP:gcc Benchmark.c -o Benchmark-c -lm -fomit-frame-pointer -OX
    FHexpe:gcc Benchmark.c -o Benchmark-c -lm -march=pentium3 -O3 -pipe -fomit-frame-pointer -fforce-addr -falign-functions=4 -fprefetch-loop-arrays (http://www.freehackers.org/gentoo/gccflags/flag_g cc3opt.html)
    FHEOFP: (FHexpe with -fomit-frame-pointer) gcc Benchmark.c -o Benchmark-c -lm -march=pentium3 -O3 -pipe -fomit-frame-pointer -fforce-addr -falign-functions=4 -fprefetch-loop-arrays
    Unsafe: UnsOFP with out (you guessed it: -fomit-frame-pointer) gcc Benchmark.c -o Benchmark-c -lm -march=pentium3 -fforce-addr -falign-functions=4 -ffast-math -O3
    UnsOFP: gcc Benchmark.c -o Benchmark-c -lm -fomit-frame-pointer -march=pentium3 -fforce-addr -falign-functions=4 -ffast-math -O3
    Bold indicates either leader or within 100ms of leader, Italic indicates a case where omit-frame-pointer is actually faster.

    Integer test:
    normal: 20990 ms OmitFP: 21410 ms
    O3norm: 15230 ms O3OmFP: 15190 ms
    O2norm: 15200 ms O2OmFP: 15490 ms
    Osnorm: 15190 ms OsOmFP: 15250 ms
    FHexpe: 15200 ms FHEOFP: 15500 ms
    Unsafe: 15430 ms UnsOFP: 15250 ms
    Double test:
    normal: 22000 ms OmitFP: 23010 ms
    O3norm: 17540 ms O3OmFP: 17080 ms
    O2norm: 17640 ms O2OmFP: 17370 ms
    Osnorm: 21300 ms OsOmFP: 18770 ms
    FHexpe: 17180 ms FHEOFP: 17300 ms
    Unsafe: 11660 ms UnsOFP: 11710 ms
    Long test:
    normal: 48510 ms OmitFP: 48690 ms
    O3norm: 37020 ms O3OmFP: 37770 ms
    O2norm: 38040 ms O2OmFP: 38490 ms
    Osnorm: 37580 ms OsOmFP: 38290 ms
    FHexpe: 38480 ms FHEOFP: 37910 ms
    Unsafe: 37560 ms UnsOFP: 38430 ms
    Trig test:
    normal: 8360 ms OmitFP: 8400 ms
    O3norm: 7810 ms O3OmFP: 7890 ms
    O2norm: 7970 ms O2OmFP: 8040 ms
    Osnorm: 9110 ms OsOmFP: 9000 ms
    FHexpe: 7850 ms FHEOFP: 7990 ms
    Unsafe: 5600 ms UnsOFP: 5590 ms
    IO test:
    normal: 2110 ms OmitFP: 2200 ms
    O3norm: 1950 ms O3OmFP: 2050 ms
    O2norm: 2120 ms O2OmFP: 2020 ms
    Osnorm: 2120 ms OsOmFP: 2200 ms
    FHexpe: 2190 ms FHEOFP: 2120 ms
    Unsafe: 2330 ms UnsOFP: 2040 ms
    Total
    normal: 101970 ms OmitFP: 103710 ms
    O3norm: 79550 ms O3OmFP: 79980 ms
    O2norm: 80970 ms O2OmFP: 81410 ms
    Osnorm: 85300 ms OsOmFP: 83510 ms
    FHexpe: 80900 ms FHEOFP: 80820 ms
    Unsafe: 72580 ms UnsOFP: 73020 ms

    "Unsafe" is certainly the fastest, and according to all the printed values, it is accurate, but there is likely a reason why the man page describes -ffast-math as unsafe: I certainly wouldn't use it in anything I would use more than once :) omit-frame-pointer just doesn't seem to be worth losing the debugging capabilities. Suprisingly, after the -ffast-math ones, #3 is simply -O3 without -fomit-frame-pointer (but only by .4 seconds) And another suprise was the IO: I highly suspect that that was mosly being cached in RAM & 7200 rpm drives

  183. How good is this benchmark? by aled · · Score: 1

    Benchmark may be very tricky and variant, you have to understand very well what are you doing. Could someone with experience in bechmarking verify is this bechmark has any sense? The author doesn't seem to known very well the languages he is benchmark. For example he doesn't seem to know that the JVM actually compiles on the fly and the VB bechmark is writen in VB6 old style.

    --

    "I think this line is mostly filler"
  184. GCC Benchmark on Dual 2GHz G5 by Anonymous Coward · · Score: 0
    Running this code: http://www.ocf.berkeley.edu/~cowell/research/bench mark/code/Benchmark.c

    Compiler flags based on Apple TN2086: http://developer.apple.com/technotes/tn/tn2086.htm l

    Removed machine & username from command prompt only.
    $ g++ --version
    g++ (GCC) 3.3 20030304 (Apple Computer, Inc. build 1495)
    Copyright (C) 2002 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    $ g++ -O3 -mcpu=G5 -mtune=G5 -mpowerpc64 -mpowerpc-gpopt Benchmark.c
    $ ./a.out
    Start C benchmark
    Int arithmetic elapsed time: 5640 ms with intMax of 1000000000
    i: 1000000001
    intResult: 1
    Double arithmetic elapsed time: 10280 ms with doubleMin 10000000000.000000, doubleMax 11000000000.000000
    i: 11000000000.000000
    doubleResult: 10011632717.495501
    Long arithmetic elapsed time: 9880 ms with longMin I64d, longMax I64d
    i: I64d
    longResult: I64d
    Trig elapsed time: 3530 ms with max of 10000000
    i: 10000000.000000
    sine: 0.990665
    cosine: -0.136322
    tangent: -7.267119
    logarithm: 7.000000
    squareRoot: 3162.277502
    I/O elapsed time: 1090 ms with max of 1000000
    last line: abcdefghijklmnopqrstuvwxyz1234567890abcdefghijklmn opqrstuvwxyz1234567890abcdefgh
    Total elapsed time: 30420 ms
    Stop C benchmark
  185. Windows vs portability by axxackall · · Score: 1
    Most of apps do need fast CPU. They wait for the user input. But when they need a fast CPU then it's usually called a server. And when the server needs a performance the commodity is not a key-factor anymore. A decision-maker may go from Intel to other hardware vendors.

    That's why the real test should be: Python/Linux vs Perl/Linux vs Tcl/Linux vs GCC/Linux vs OCAML/Linux vs Erlang/Linux vs Haskell/Linux vs whatever-is-available-in-source-for-linux.

    In that case you can run the test on PIII, Athlon, P4, G3, G4, G5, USII, UIII etc - wherever linux is ported. Then you can see how different hardware helps to performance. And you could see how different compilers utilize thos hardware resources.

    --

    Less is more !
  186. vt220 emulation with user definable fonts? by Waldmeister · · Score: 1

    Hi,

    this is completely off topic, but du you know a vt220 emulation with user definable fonts (softfonts?) implemented?

    I tried some teminal emulators, e.g. jta, to replay some old ascii art movies, but none had this feature.

    t.i.a

    1. Re:vt220 emulation with user definable fonts? by Kent+Recal · · Score: 1

      maybe this helps

    2. Re:vt220 emulation with user definable fonts? by Doomdark · · Score: 1
      this is completely off topic, but du you know a vt220 emulation with user definable fonts (softfonts?) implemented?

      Nope; that's one of few things from 220 I did not implement (should have said 90+% vt-220, half of vt-320... didn't implement sessions either). I did implement double-width/double-size fonts, blinking, and default "gfx" character set, plus also switchable speed throttle (9600 bps etc); just for fun so that most vt-animations would work. :-)

      I probably didn't see decent description of user defineable fonts on web back then (plus, I'm not old enough to have extensively used real vt-220 emulators except during my first college year for playing muds, before getting into x-work stations... so I wasn't aware of such a feature). Could have been nice to try to implement it.

      In case you want to have a look at what I implemented (which after rewrite a year ago is not 100% as compliant as it used to be, but is much cleaner source now), you can find it via Google; search for "jiveterm home page". I always thought one of these days I'd finish it, since it's kind of cool thing to have done. =)

      --
      I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
  187. IBM is *much* faster by Anonymous Coward · · Score: 0

    It's just Sun's implementation which is b0rked. IBM's JVM for Linux computed that trigonometic test eight times faster on my box...

    The whole test ran in just 38.2 seconds, down from Sun's 131.5. (yes, I used the -server flag)

  188. Pff by autopr0n · · Score: 1

    Real men use LUTs!

    Or they use hardware which converts the number into a time index, then reads a value off of an analog signal generator. Less then one clock cycle!

    --
    autopr0n is like, down and stuff.
  189. Re:Speed? No. Stability. Yes by Anonymous Coward · · Score: 0

    And doing runtime type analysis because your language lacks the necessary functionality to perform static analysis is retarded. Instead of going one-on-one with a straw man, maybe you could try staying on topic.

  190. Why Speed matters... by gillbates · · Score: 1

    Scalability and code reuse.

    Often times when someone writes something useful, other programmers want to use it as a building block in larger applications. The problem is that the interpreted languages make this kind of system building almost impossible. While your WonderWidget might work well for parsing a single file or two, the performance differences really begin to show up when it gets called for every file in a directory, or is scaled up to handle large files. An order of magnitude difference is trivial when used in an end-user application and the elapsed time is only a second or two. But that difference becomes really significant when working with large amounts of data.

    I know people downplay the performance disadvantages of interpreted languages, but this is still a very real problem for businesses. A small corporate system has a thousand modules; the larger ones have upwards of 30,000. A single millisecond difference in execution speed makes a full second difference in user response time. While one second isn't likely to be noticed by a consumer-grade web user, online help desks can't wait 30 seconds for a page to load.

    I guess I should qualify this further. I know of projects using interpreted languages that have failed - the application did work - albeit, it took 30 seconds (best time) to 5 minutes to respond to a single keystroke. It was later abandoned because despite buying faster hardware, the programmers couldn't get better than a 20 second response time. An average improvement of just 15 milliseconds per module would have saved the project!

    --
    The society for a thought-free internet welcomes you.
    1. Re:Why Speed matters... by kpharmer · · Score: 1

      > I know of projects using interpreted languages that have failed - the application did work - albeit, it
      > took 30 seconds (best time) to 5 minutes to respond to a single keystroke. It was later abandoned because
      > despite buying faster hardware, the programmers couldn't get better than a 20 second response time.
      > An average improvement of just 15 milliseconds per module would have saved the project!

      Or how about - some one could have made the design decision to avoid going through 1000 layers of abstraction? I mean, you do begin to hit diminishing returns at some point, eh?

      Right now I'm using python to perform heavy transformations on firewall data - tens of millions of rows per day. Looks like this process will handle around 300 million rows per day on a single robust server.

      1. Would it be faster in C or C++? Sure
      2. Would the change of a defect increase in C or C+ vs python: Sure, far more chance to screw something up
      3. Is it worth rewriting in order to get 1200 million firewall events / day instead of 300 on a single server? Not now - I'd rather keep it in python and just split the processing across two servers than implement in C or C++. Of course, we could always go to psycho, or rewrite small parts first. But eventually, if those steps failed to keep the load manageable, then *maybe* i'd consider rewriting in C/C++.

      Of course, keep in mind that this is python handling 1.2 *billion* heavy transformations a day by the time I'm starting to think about a real performance problem. So, can it handle performance-intensive projects - sure. Is it the fastest solution out there? not by a longshot. Are there things that matter more than speed. Yeah, a ton.

      Keep in mind that the most powerful factor in performance-tuning has nothing to do with design - but rather with requirements. I've done a lot of performance-tuning in which I completely eliminated elegant and efficient designs - that simply weren't needed. They were solving a problem that didn't exist. One advantage of a higher-level language like python is that you spend more time at the requirements level - and can more easily detect this problem.

    2. Re:Why Speed matters... by pHDNgell · · Score: 1

      1. Would it be faster in C or C++? Sure
      2. Would the change of a defect increase in C or C+ vs python: Sure, far more chance to screw something up
      3. Is it worth rewriting in order to get 1200 million firewall events / day instead of 300 on a single server? Not now - I'd rather keep it in python and just split the processing across two servers than implement in C or C++. Of course, we could always go to psycho, or rewrite small parts first. But eventually, if those steps failed to keep the load manageable, then *maybe* i'd consider rewriting in C/C++.


      There are more languages than python and C and C++ (two different languages).

      I had a similar issue with some of my log processing apps at work. I prototyped all of the original stuff in python, and in some cases it was taking 23 hours to process the daily logs. I tried various languages for rewrites. I really dislike C as a language, but I rewrote some of the slowest components in C while looking at other languages.

      This was a very good thing for me, as it's how I discovered O'Caml. It's a very pleasant language to use...very high level, functional, generic, statically typed (but types are inferred, so you write like you're writing dynamically typed code), and mind bogglingly fast. It's not uncommon to see stuff like this from new users:

      http://caml.inria.fr/archives/200401/msg00301.html .

      --
      -- The world is watching America, and America is watching TV.
    3. Re:Why Speed matters... by kpharmer · · Score: 1

      > There are more languages than python and C and C++ (two different languages).

      Sure, though I think that they express the extremes pretty well.

      My shop is primarily java, but I introduced python since it's much faster/easier to develop and maintain, and we have few real java experts. Python was an exception, but I've got an ace in the hole if I get challenged on standards-compliance: I can run it in a JVM with a seamless bean/class interface (jython). I'm not eager to push yet another exception on the standards guys. At least not yet. ;-)

      But I will take a look at O'Caml anyway

      Thanks

    4. Re:Why Speed matters... by pHDNgell · · Score: 1

      We're also a java shop. We use struts in our app and I've built a thing that allows us to write struts actions in jython or bsh (the latter just to prove the interface was generic, I don't much like bsh).

      Right tool for the job and all. I can reliably process a *tremendous* amount of data with my ocaml apps very quickly. And I like the language. :)

      I tend to chain a few things together. I've got processes that consist of bourne shell scripts, python, jython, ocaml, and pure java apps. And the whole thing's documented in a web server/wiki written in smalltalk. :)

      There's something to be said for trying to establish standards, but it takes many tools to build something useful.

      ocaml is slowly migrating from the tool that I use when speed is a priority to the general purpose tool for which python used to always be the first choice.

      --
      -- The world is watching America, and America is watching TV.
  191. If speed isn't an issue by arevos · · Score: 1

    If speed isn't an issue, why is Java's design rooted in C++? There are far better designed languages than Java around. If I wasn't looking for a fast application, I'd probably consider using Python.

    Java offers little advantage over C++. It has a garbage collector, has some useful libraries built in, and cross-platform compatability, and to some degree, makes pointers safer (at the loss of functionality). But that's about it. The Java libraries don't do anything so special that there isn't a standard C++ library to match it. And Java lacks pointers, polymorphism, and yet, for some rather obscure reason, keeps basic types.

    I'm not saying C++ is a good language. It isn't, really. But nor is Java, by any stretch of the imagination. C++ has certain features, such as basic types, that are the legacy of C, and in some programs, are needed for speed purposes. Java has them because... Well, actually, there isn't a compelling reason to have them at all. And that's just one feature of the language. Java isn't very well thought out at all.

    I wouldn't say I was an anti-Java zealot, but I can't see many advantages to using Java.

    1. Re:If speed isn't an issue by Anonymous Coward · · Score: 0

      "The Java libraries don't do anything so special that there isn't a standard C++ library to match it"

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

      "and to some degree, makes pointers safer (at the loss of functionality)." and "And Java lacks pointers" well which is it? Does it have pointers or not? (Yes it does - and yes they are restricted - and the issues that that cuases is not overly severe).

      "for some rather obscure reason, keeps basic types"

      When it was interpreted the original language (which did not have primitives) was found to be too slow - so they havked primitives in. They shouyld have done it a nicer way - bad Sun.

      "But nor is Java, by any stretch of the imagination."

      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.

      "Java has them because... Well, actually, there isn't a compelling reason to have them at all."

      C++ would have been stillborn if it was not C-like - Java would have been if it was not C++ like. Remeber what the target audience for Java started out as - C++ programmers - it needed to be familair for an easy transition. It definatly got that right.

    2. 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.

  192. Parent -1 Troll by Anonymous Coward · · Score: 0

    Comparing Perl to Java is foolish

    Statements like these are given without justification and only reflect the ignorance of the author.

    Since when does Awk provide packages, hashes, symbolic and hard references, OO constructs, closure, etc.

    Please be specific on Perl's missing attributes that backs up your statement not meant for large projects at all

  193. What is the largest Python project? by Anonymous Coward · · Score: 0

    Just curious, what is the largest Python project (in terms of active programmers)?

  194. Try to be more specific by Anonymous Coward · · Score: 0

    I'm loathe to use Perl as production, considering most Perl code cannot be understood 2 weeks after it's written.

    What specifically do you loathe about Perl? What features or attributes does, lets say C have, that Perl does not that contributes to readability issues?

    I think you have limited experience in Perl and people tend to loathe that which is unfamiliar. Try to be more honest.

    1. Re:Try to be more specific by Camel+Pilot · · Score: 1

      I have maintained both large programs in C and in Perl - and from my own experience I would rather maintain Perl any day over C assuming all things are equal (ie design quality and style).

      With Perl there are less intrinsic variable types and variable types are obvious from the prefix. Perl lends itself nicely to componentization, hence CPAN and large programs if designed properly ended up as a collection of smaller managable modules - which is what good design strives for the breaking down of a large problem into many smaller more managable ones.

      Most people confuse reg exp with Perl. The at one time encountered a wild ass reg exp and recoiled in fear and loathing - and form an opinion from that point forward that Perl is unreadable.

  195. 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

  196. JRocket by maxbic · · Score: 1

    from the article:
    BEA has an interesting JVM called JRockit which promises performance improvements in certain situations, but unfortunately only works on Windows.

    Not true:
    http://edocs.bea.com/wljrockit/docs81/certi f.html

  197. Python shines in initial development by ReyTFox · · Score: 1

    Python is also great as a language to port from. The python.org stories from companies and groups using Python often say something like "We started with Python, and were wowed by it's ease etc., and then as our code matured we started converting parts of it to (C/C++/Java/etc)."

    Now, you might want to take that as a bad thing, that Python isn't good enough to keep using indefinitely, but that's not really the reason they stop using it. It's more often a question of speed or skills needed for maintainence - not as many people know Python as they do C(++) or Java, and with a clear reference implementation to work off of, rewrites(partial or complete) for other languages are usually fairly straightforward. If only certain bits need optimizing, the C integration features become quite handy. The standard libraries make good use of C to optimize the heck out of the most frequently used features, which would account for the I/O being comparable with all other languages. A similar result, or at least one much closer than with this benchmark's tests, would probably occur if you benchmarked some of its handy built-in data types with their equivalents in other languages.

    So there are, fortunately, plenty of ways to get around Python being slow in benchmarking, if you aren't doing something that requires a heavy amount of raw number-crunching like these benchmarks.

  198. No more VB by truthsearch · · Score: 1

    For new desktop apps Visual Basic 6 is no longer an option. I've been a full time VB developer for years. With the end of the VB line comes a switch to .NET or something else. VB.NET is not the next version of VB, but a complete rewrite. The best alternative I've found for rapid desktop app development is Python with the wxPython library. It's cross-platform, executes very fast, and requires little code for basic stuff. Microsoft would have us drop everything and move to .NET, but my experience with C# on .NET has been far less than pleasant. I know C++ so the learning curve is minimal. The problem is Microsoft's promises of automatic memory management and rapid development of complete apps is a joke. It's riddled with bugs and memory leaks. It requires far more coding than VB did or Python does. This is an important time for VB developers and they should move along to the freedom and speed of non-Microsoft tools.

  199. Lies, damn lies... by fm6 · · Score: 1
    Yea its definitely not a comparison on languages. Its more a test on compilers.
    So why choose one compiler for each language? That's a rhetorical question, the answer to which is that the writer didn't understand how important this distinction is. He simply downloads the free Java SDK as if that's the only Java runtime anybody would use. There are non-free runtimes from Sun and others that provide a much higher level of optimization. Probably they'll never catch up with native code, but no useful comparison of languages, compilers, or runtimes can ignore them.

    This whole "language benchmark" is brainless on a bunch of different levels. As others have previously mentioned, the benchmarks don't even vaguely resemble what people actually do with these languages. Plus, a lot of programmers can afford to take the performance hit to get the particular features of the language. And last but not least, the benchmarker hasn't got the vaguest notion what of what he's actually measuring!

  200. just for giggles.... by the_greywolf · · Score: 1

    why doesn't someone extend this test to my favorite interpreted language (REBOL) and my least favorite and most despised compiled language (see sig)? you know. just for giggles.

    --
    grey wolf
    LET FORTRAN DIE!
  201. One glaring problem by pico303 · · Score: 1

    The commentator (not OSNews) ran his benchmarks with the -server flag in Java. That's a terrible flag to use for short-term client applications, such as these benchmarks. Running the test without the -server flag, and the times will probably improve a little (just a guess).

    That said, I have found Java on Windows to run noticeably faster that Linux or even Solaris. Not terribly so, but such that you can tell the difference. Wish they'd optimize it for Linux a tad more.

  202. games by dfj225 · · Score: 1

    "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'm guess that in programming 3D game engines or any part of a video game for that matter, this would be one of the largest, if not the main, consideration.

    --
    SIGFAULT
  203. Not a very accurate comparison by zapadlo · · Score: 1

    The test was on the Linux box, why in the world wouldn't you compare Blackdown's Java. It was proven that it is the fastest implementation of Java !For Linux!. It was also proven that Sun's JVM is not very efficient on Linux.
    http://www.volano.com/report/index.html

  204. Why Java just-in-time fails in certain cases by Skapare · · Score: 1

    Java just-in-time compilation will fail to perform well in certain cases. In fact, even if it were to completely compile itself into native code right from the outside, it will still fail to perform well in these certain cases.

    The cases I speak of are when multiple processes are using the same executable code, which for Java will be the class file, and for compiled C source will be an ELF executable image. When Linux and other Unix systems run these programs, the original executable image is memory mapped by the kernel or the run time loader. At this point the pages are all shared between multiple processes. The run time loader will link in necessary libraries, which will modify a few pages and result in them not being shared due to copy on write. But these are generally the jump tables and few other things that happen to be in the same page area. Most of the executable machine code is not modified.

    When a Java class file is loaded, the executable as far as the system sees it to be is the Java run time engine itself. When it compiles the Java byte code at run time, it can produce good performing code, but it can't cause that code to be shared in memory with other processes that were running the same Java class file.

    OTOH, Java applications tend to be run as threads, not multiple processes. As long as the compiling of the code is done so that there are no thread collisions in that (you'd know pretty quickly if there were), then you have one copy of the code shared between all threads.

    The use of threads and Java is a tradeoff. You get the better program protection of Java (and not programming with pointers, which the average programmer is not capable of dealing with very well), but you also get the risk of threads (it's still possible to program badly for threads even in Java, and get data crossover where it should not be).

    But when you see benchmarks that say one is better than the other, you better have a close look and see exactly what kind of thing is being tested, including whether multiple instances in processes, vs. multiple instances in threads, is being done. In some cases (like when it has to be processes, not threads) you might want to consider using a Java to native machine code compiler, or if you can handle it, program in C or C++.

    --
    now we need to go OSS in diesel cars
  205. JVM switch setting for interpreted to native: by freality · · Score: 1


    The author's benchmark doesn't account for this switchover:

    http://java.sun.com/docs/hotspot/VMOptions.html

    java -XX:CompileThreshold=10000 Test

    other interesting flags:

    -XX:+PrintCompilation
    -XX:+PrintInlining

  206. Cygwin over MinGW binaries?! by ndogg · · Score: 1

    I cannot figure out for the life of me why the heck Cygwin's GCC was used over MinGW.

    Every single binary created by Cygwin's GCC must be linked to cygwin.dll, which is an absolutely enormous performance overhead. GCC would have performed much more strongly had MinGW's GCC been used.

    --
    // file: mice.h
    #include "frickin_lasers.h"
  207. Java scientific computing performance benchmark by Thorgal · · Score: 1

    While we are at it, you may wish to check Java application benchmark I wrote some time ago. JatMark

    --
    "Man in the Moon and other weird things" - wfmh.org.pl/thorgal/Moon/
  208. Proof that Java is not slow...? by Anonymous+Brave+Guy · · Score: 1
    This is (once again) proof that Java is not slow, in fact it's really fast.

    To be more accurate, it's proof that Java is not slow when performing trivial tasks.

    These benchmarks test trivial operations, most of which can be done in just an instruction or two of machine code inside a loop on the test platform. Any language in a serious performance league should execute these at near identical speeds, modulo up-front time for JIT compilation. It would be laughable if a serious player didn't, and indeed it is laughable that two of the .Net languages were so much slower for I/O, that Java's new floating point performance is so abysmal, and that GCC has a performance so much slower than VC++.Net.

    As the report acknowledges, benchmarking usefully is hard. Indeed, many very credible figures in the programming community refuse to compare languages directly in this fashion, precisely because it's so difficult to get any results that are realistically meaningful. To get a fair comparison of the raw performance of (to take everyone's pet holy war) C++ and Java, you'd have to write a much larger-scale test application in the field you were interested in, which would use not only trivial mathematical operations, but also wider optimisations for complex calculations, many function calls, various data structures and algorithms, and so on. I'm aware of no serious benchmarking exercise that has ever done this.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  209. Re: Comparing Perl to Java is foolish? by Proudrooster · · Score: 1

    Comparing Perl to Java is foolish, Perl is more like Awk than a general purpose programming language

    If 'C' were a person, he'd be hardworking, fast, organized, efficient, smart, and flexible enough to solve nearly any type of problem. He'd also live a quiet simple live, eat right, excercise, and go to Church on Sunday.

    If Perl were a person, he'd be C's fat, lazy, but brilliant son. Able to complete most any task with minimal effort, so he could go back to being fat and lazy. He would also borrow largely from the accomplishments of his father, but not work as hard to achieve the same result. Perl would party on the weekend, cosume large amounts of high fat food, drive a Harley Davidson motorcycle, and only attend Church on Christmas eve, just to make dad happy.

    When Java and .NET finally die. Guess who will attend the funeral? Yep, C and PERL (Father and son) will still be going strong and C (at least) will still be working hard.

    Perl like Python is a swiss army chain-saw. You're right in saying Perl shouldn't be compared to Java. PERL is much more high level and can reduce development time from weeks to days. Perl can be used for large projects as long as you establish a dialect among the coders. Using Java for a large project can turn into a disaster quickly, especially if all the developers start writing all their own classes and doing platform specific things like OS specific system calls. I often use Perl to do mockups for Java projects since I can go from concept to working prototype in mere hours.

    Do not underestimate the power of Perl, especially for web development and back-end development work. Perl is my absolute favorite programming language and I write in many including C/C++, VB, Java, PHP, but never .NET ...

  210. 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.
    1. Re:Athlon versus Pentium 4? by guardia · · Score: 1

      I also did note that Sun's JVM run _a lot_ more slowly on Athlon than on Pentium III/4 ... the IBM's JVM, however, seems to perform pretty much equally well on both Athlon and Pentium. Go figure!

  211. Way O/T political point by Anonymous Coward · · Score: 0
    It's better to live on your feet than to die on your knees.

    It is indeed, but the usual question is whether it's better to die on your feet or to live on your knees. And that's a much tougher question, if your loved ones are the ones with guns to their heads. I am pretty liberal, but there are limits in the real world.

  212. C++ vs. Java for maths in the real world by Anonymous+Brave+Guy · · Score: 1
    Incidentally, if you avoid platform, compiler and processor specific features, I suspect C++ is even more mind-bogglingly slow than Java.

    And I suspect you have a deep misunderstanding. :-)

    Did I mentioned that I am one of those guys who does write performance-critical maths code, and it does ship on more than a dozen platforms, and it pretty much doesn't use any of the specifics you mentioned?

    I'm sorry, but I've played this game for a while. I have looked at the assembly output of numerous C++ compilers on different architectures to identify performance problems or compiler errors in low-level libraries, resolved tricky numerical analysis issues when computing the roots of quartics to double-precision accuracy, investigated writing what are effectively mini-interpreters for some repetitive coding tasks we do, including JIT and dynamic optimisation issues, made decisions about squeezing a precious 4 extra bytes into a data structure (precious when your structures might be used millions of times) or whether such-and-such a function can be non-virtual to save calling time, all against a background of automated numerical tests that squeek when your results on two platforms differ in the 14th sig fig or so.

    The conclusions are crystal clear, and a language like Java will never even come close to producing the speed we need. Other radically different languages might; I have an interest in high-level, functional languages, and the interesting possibilities for compiler-provided optimisations there could make for some worthwhile experimentation at some stage. But not Java. It has too many "hard" down-sides, and precious little to make up for them in this context.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  213. C/C++ and Win95 by Anonymous+Brave+Guy · · Score: 1
    By that logic, C/C++ must suck really badly, because we all know how unreliable Windows 95 was.

    Actually, C and C++ do suck as languages for writing operating systems. It's just that the more practical potential alternatives still suck even more.

    It's kinda sad really. We've had near enough three decades of advances in programming language technology since C was invented, and yet we're still writing our most critical software in weak, cumbersome, unsafe languages that are just a step or two removed from assembly. Worse, much (thankfully not all) of the serious R&D in industry still seems to be based around these near-prehistoric monstrosities and the pseudoclones built on them. No wonder so few people are really innovating in the software world.

    None of which negates your point that judging a language by a single project written in it is a daft thing to do, of course. I just happened to disagree with your counterexample. :-)

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  214. In truth, chincy "cost of coder" choice == anathma by IBitOBear · · Score: 1

    We have lots of "coders" but in truth there is an agregious lack of "designers".

    In Aphorisim: Failing to Plan is Planning to Fail.

    The real cost of software is generally in the noise floor compared to the *realized* cost of the software caused by people tyring to bean-count their way to a solution using over-simple metrics.

    In the last decade that overly simple metric was money, before that it was kLOCS (thousands of lines of code).

    "Good code" is just that, "good". The "right code" is outstandingly good for what you are doing and has all the right intangibles for your need. But like the difference between "good" and "bad" is like art, "good code" really doesn't *have* any single empirical metric. Heck, even "works" vs "doesn't work" well, doesn't work as a metric since you can only honestly go as far as "seems to work".

    Efficacy, Correctness, Near Term Cost, "TCO", Competeion vs Penalty Cost (over the domains of time and money); all of these are important factors.

    Whoever you be, save your self grief and cash: Find a good designer, who you can *talk* *to* *EFFECTIVELY* or just live in your mess.

    Just now my company is being held hostage by one of our founders. She has the code effectively in escrow and won't talk to anybody about anything. She insists you "just tell her what to do and she'll do it" and GOD SAVE YOU if you have to change your mind about the slightest detail or explain it to a customer.

    Really, hell hath no furry like a (wo)man engaged in self-protectionist isolation over a bad design and peacmeal implementation.

    It was "cheap and fast" and that will be costing us for an *EXCEEDINGLY* long time.

    You have been warned... 8-)

    --
    Innocent people shouldn't be forced to pay for inferior software development.
    --"Code Complete" Microsoft Press
  215. Java is _way_ portable by kupci · · Score: 1
    If you avoid platform, compiler, and processor specific features, C++ is even more portable than Java.

    Problem is, when given one of those constraints, i.e. "if you just ", well, that never happens and you get platform specific code. Certainly C and C++ were more portable than their predecessors, but Java is an even further improvement. Thus some rather cool stuff, like I can build on NT and deploy to Solaris, OS/390 (and now zOS, or AIX. Same exact jar. These are not trivial apps either, thousands of custom classes with a 100 or so supporting jars, all running on an application server (WebSphere).

    Pretty cool, and it works so well, you sometimes forget what a tremendous feat it is.

  216. Depends on programmer quality by Anonymous Coward · · Score: 0

    If you take average programmers, Java creams C++. If you take good programmers, C++ creams Java. If you take top programmers (tine fraction of a percent), Lisp/Scheme creams C++ and Java.

    The advantage of Java is that it forces a specific programming style (object oriented), forces people not to use potentially dangerous constructs, etc. This is great for mediocre programmers who cannot discipline themselves, or for maintainability of a project over multiple sets of programmers, since it guarantees a certain standard for the code.

    However, Java falls apart for complex projects, where you very rarely, but still on occasion, need something like templates or multiple inheritence, and almost every large Java project I've seen has some nasty cludges to work around lack of expressibility in Java.

  217. This benchmark is Pointless by MatthewNewberg · · Score: 1

    This benchmark is completely pointless for a few reasons. No one is writing programs like this, and will never write programs like this. Programs are always more complicated. The operations dont consider the precision, which affects many of the languages trig functions. Which I feel should be thrown out. Most programs are not bottelneck by performance either. Almost any programmer can write a better program then a for loop, hopefully this benchmarker can live up to this. BTW... Wow Java is fast, but could someone write some real benchmarks to prove it.

  218. Re:Speed? No. Stability. Yes by jilles · · Score: 0, Flamebait

    If safety is critical, don't use any C variant. Really, 99% of security problems can be attributed to stuff the java virtual machine prevents from ever happening (e.g. buffer overflows). This type of error is routinely discovered even in C programs that have been subjected to multiple code reviews (e.g. some of the server software that is shipped with BSD). In a C/C++ program, discovering an error at run-time is usually fatal whereas in Java you simply handle the exception (and of course you build in some stuff to recover nicely from such unfortunate events).

    As others have pointed out, templates are planned for the next Java release (in addition to a number of other nice language features). Compared to C++, the Java version of templates is particularly strong on typesafety (which in Java was a hard requirement whereas in C++ it is just convenient to have). If you go to javalobby.org, you can sign up for an alpha release of the jdk1.5. Alternatively, you can download some extensions that will work with existing versions of java.

    Anyway, there are real-time variants of Java if you need hard real time and for soft real time stuff you can configure the garbage collector to be less of a pain in the ass (with a few percents performance penalty). Garbage collection used to be a problem when SUN still used a very naive garbage collecting algorithm, that was fixed long ago.

    --

    Jilles
  219. If you want the best performance by Anonymous Coward · · Score: 0

    use lightweight c++ . Otherwise Python is the choice.
    my 0.2 cents

  220. Microsoft J++ == .NET version 0.9 by Latent+Heat · · Score: 1
    Most of what they have in .NET is just repackaging of J++. J++ languished because true Java dudes didn't want to be polluted by it and VBers had little interest in it. But J++ was everything VB is in terms of RAD development and the so-called Visual C++ is not, and it was a C-syntax language with a JITed interpreter to boot.

    But if .NET really catches on (yeah, yeah Longhorn, but to echo a familiar refrain, where are the shrink-wrap apps? When is MS going to eat their own dogfood on this one?), someone should run a copy of J++ in a museum exhibit somewhere (it is perhaps like the Lisa to the Mac that finally caught on).

  221. Hmm, no answer. by Anonymous Coward · · Score: 0

    Slashdot isn't funny anymore...

  222. Python for Numerical Analysis by Anonymous Coward · · Score: 0

    Actually, numerical analysis in Python can be much nicer than in other languages.

    Check out http://numpy.sourceforge.net

    Using some basic features of the language, it does some things with numbers that just normally aren't very easy (let alone generate code as clean as what you see in numpy).

    Python is one of those languages where style is important. There are a lot of things in Python that need to be written in certain ways that utilize the features of the language.

    To give an example, let's say you need to build an arbitrarily large list of floating point numbers, then call some operation on them. Python can do a case like this extremely fast when written right. Most of the slowdowns in Python occur during lookup of names or loops. Both can be eliminated easily. See this code snippet that, for giggles, takes the sine of a list of numbers (although imagine a really long list).

    l = [1,2,3,4,5]
    from math import sin
    output = map(sin,l)

    These three lines will take a list of arbitrary size and munge it nicely. Furthermore, in Python 2.3 the map function will work on an iterator. Iterators allow you to repeatedly suck in data in a way that doesn't require having all of it in RAM at once. One nice application of this is to read from, say, an INET socket, as data comes in instead of buffering it all in RAM. So this could be extended as follows:

    from urllib import urlopen
    from math import sin
    u = urlopen("http://www.somewhere.com/data")
    def process(data):
    return sin(float(data))
    print map(process,u)

    As an example to test the above, I decided (for no apparent reason) to load slashdot's main page in and measure the length of each line. This was no more than.

    from urllib import urlopen
    u = urlopen("http://slashdot.org")
    print map(len,u)

    Need the average line length of Slashdot?

    from urllib import urlopen
    u = urlopen("http://slashdot.org")
    def avg(avgdata,newdata):
    (sum,count) = avgdata
    return (sum+len(newdata),count+1)
    (sum,count) = reduce(avg,u,(0,0))
    print float(sum) / count

    Doing the above in other languages is a lot of work and usually much less expressive. In addition, the basic language features (iterator protocol, map, reduce, list types) make this remarkably efficient. Map and reduce are both tight C loops. They don't spend time doing symbol lookup except during initial invocation. Iterators allow all of this to occur without having to buffer everything in memory. It's actually iterators the whole way. Urllib uses a socket as an iterator, urllib's urlopener is an iterator, reduce then iterates that. Disturbingly, this can also make things easier to maintain. Less lines of code is really the big boon of python (although strong introspection comes second).

    Also, there's more to it than just this. There are benefits you just don't get anywhere else. Try subclassing an integer anywhere else. Not subclassing a wrapper class for in integer--SUBCLASSING THE INTEGER! As of 2.3 all of python's primitive types are first-class objects.

    Combine all of that with judicious use of classes and it can manipulate data in general (and numbers in particular) like nobody's business. If you want to see how powerful the interface can be, just load up Python 2.3 and type:

    dir(5)

    When you understand what you're looking at, you'll be amazed.

  223. perl is compiled! by Anonymous Coward · · Score: 0

    Thanks.. i never knew

  224. Answer by SuperKendall · · Score: 0

    Java 2 v1.5

    It's not that hard, especially for a programming language where the users are assumed to be a little bit technical...

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:Answer by Trejkaz · · Score: 1

      Well, the product is "Java2", the version number is "1.5", yeah.

      What gets me is that people think this is the first time a company has done this. Get over it people! Nobody bitches at id Software because Quake III is version 1.32.

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
    2. Re:Answer by Bob+Davis,+Retired · · Score: 1

      No, people would be bitching if ID called Quake II v. 1.2 Quake III, which is what Sun have done. It isn't Java2, it's Java 1.4

    3. Re:Answer by Trejkaz · · Score: 1

      Your analogy is broken. Effectively the later versions of Quake 1 did become Quake 2, and the later versions of Quake 2 did become Quake 3.

      Sure, massive rewrites occured between each of those tiers, but there were massive rewrites between Java 1.1 and Java2 1.2 also.

      How about another example? What about Gabber2 v1.9.2?

      --
      Karma: It's all a bunch of tree-huggin' hippy crap!
  225. Why Java is hopeless for code efficiency by Anonymous Coward · · Score: 0

    ... because of the code execution model: local non-scalar variables have to be allocated dynamically (as with malloc, which is very expensive) this being the semantics of the language. Code which rarely creates new non-scalars (there is rarely such code when writing Java programs in the normal way), if compiled natively, can in principle perform as C code. See for example: dan.corlan.net/bench.html

  226. Re:Benchmarks? Who cares? by spongman · · Score: 1

    There's no reason that Sun's JIT couldn't recognize that it's running on a P4 and generate SSE2 instructions to gain performance. If it doesn't, then it doesn't and that's a reflection of the quality of the JIT. If it does and it's still slower, then it's just slower.

  227. trig implementation is slow because... by micromuncher · · Score: 1

    of its JNI implementation.

    When you call a trig function, it goes through the java.lang.Math class. However, Math delegates to StrictMath that is a native implementation. Now, I do not believe that Sun has implemented the trig libraries because if you dumpbin on java.dll where StrictMath resides, you will notice most the offsets between those functions is small (about 20 bytes).

    So when you call any trig function, you have 2 levels of object packaging/unpackaging - likely before a call that sets fp numeric state before the operation.

    http://math.nist.gov/javanumerics is a fun place to visit for more information on various math libraries and issues people have with java numerics.

    --
    /\/\icro/\/\uncher
  228. Re:Benchmarks? Who cares? by Frobnicator · · Score: 1
    There's no reason that Sun's JIT couldn't recognize that it's running on a P4 and generate SSE2 instructions to gain performance. If it doesn't, then it doesn't and that's a reflection of the quality of the JIT.
    Exactly. It does not mean that the language version is inherently better or worse (as the author erroniously claimed).
    --
    //TODO: Think of witty sig statement
  229. Re:Speed? No. Stability. Yes by cduffy · · Score: 1

    Eh? Static analysis can be done in Python. See pychecker.

  230. Interpreting a language can ... speed it up ! by glacote02 · · Score: 1

    On this older review
    http://www.arstechnica.com/reviews/1q00/dy namo/dyn amo-1.html
    HP labs showed that interpreting code which could even have been executed natively can actually improve performance. The idea is that many optimizations can not be done at compile time because of non-static variables; on the other hand the run-time engine can "discover" that said boolean is always false an drop a jump that a static compiler could not have ignored.

    Note in particular that the Caml language is often found to be as fast, if not faster than C (even though it is intrinsiquely interpreted) for this reason.

  231. Languages have no performance. by Trejkaz · · Score: 1

    To be completely strict, languages don't have any performance. The only way you can judge how 'fast' a language is, is to test how long it takes to write a program in that language.

    They were comparing compilers and runtimes, I thought that was a given.

    --
    Karma: It's all a bunch of tree-huggin' hippy crap!
  232. Re:Speed? No. Stability. Yes by Trejkaz · · Score: 1

    Actually strictly speaking, it's wrong to imply STL's typed containers are generics. They are templates. The difference is supposedly that when templates are expanded, List<String> and List<Goat> become different classes, by generating a new class which has the template expanded.

    Java's generics (coming in Java 1.5), are 'true' generics in that there is always only one instance of the class, but the class has parameters.

    For the most part generics are in fact a compile time feature anyway. This is why compilers for Java have existed which did generics, as far back as Java 1.2, and possibly earlier. The difference in 1.5 is it will be possible to dynamically see at runtime which parameters are being used for a generic type, via reflection.

    --
    Karma: It's all a bunch of tree-huggin' hippy crap!
  233. What is the point of all these comparisons? by Austin+Milbarge · · Score: 1

    It's actually a very simple problem made more complex for no reason. Look, languages can be broken down into three basic families.

    Application development - C, C++, VB, Delphi, Java
    All purpose scripting - Bash, Python, Perl, Awk
    Web development - PHP, Javascript, ASP

    Each family has it's function. No matter which language you choose from the above careful design and good use of algorithms go a long way as far as stability and efficiency are concerned. I've seen C++ programs run slower then Awk scripts. Why? Too much code. The C++ programmer probably spent lots of time programming things like I/O and buffer overrruns to the point where using Awk would have been a better choice.

    Bottom line, experience is unfortunately the only way to gain an understanding of algorithms and optimization. A compiler can only aid the knowledgable and I consider myself just a beginner. However, as a programmer, knowing that Visual C++ or gcc produces the fastest code is a moot since there are many more factors that go into deciding which product to use. How about ease of use of the development environment and technical support? Case in point. I'm a big fan of Linux, but ever wonder why those apps never really look or act polished? That's the direct result of poor development environments for that system since programmers end up spending more time on the compiler and customizing the development environment than they do on the actual problem they wish to solve.

  234. Re:Benchmarks? Who cares? by Anonymous Coward · · Score: 0

    The man has an associates degree in computer science, and a Ph.D. in psychology. .

    Not true at all and weird that you'd say so. If you actually read the brief bio blurb, you'd see he has a Bachelor's degree in computer science (Harvard writes their bachelor's degrees "backwards" as in A.B.) and a PhD in philosophy (not psychology), where he concentrated in artificial intelligence.