5 ms·
You'll get similar results for most benchmarks. Languages such as Ruby/Perl/Python are consistently slower than Java. There's no such thing as a perfect benchma
by thebluesky 14y ago
You'll get similar results for most benchmarks. Languages such as Ruby/Perl/Python are consistently slower than Java. There's no such thing as a perfect benchmark, but I've found the language shootout page to be a pretty accurate reflection of what I've observed in practice.
- Roboprog 14y agoMy data says "usually, but not always": http://roboprogs.com/devel/2009.12.html http://roboprogs.com/devel/2009.12.html I suppose I need to update this on newer machines (e.g. - 6 core AMD box I have now, for starters, instead of an old Pentium-D), and it's certainly possible I FUBARed the Java implementation. If anybody thinks they can clean up the Java, so that the single-threaded performance is better, here it is: https://github.com/roboprog/mp_bench https://github.com/roboprog/mp_bench I got similar results, albeit with much older versions of Perl and Java, about 10 years ago on sample code I made to index a flat-file in Perl and Java. That code belonged to my then employer, so I don't have it.
- igouy 14y ago>> FUBARed the Java implementation << // deliberately *not* using StringBuffer / StringBuilder, // as a real app would have many transient string variables
- Roboprog 14y agoBecause I know that every corporate app dev is (NOT) going to write: StringBuilder buf = new StringBuilder( s1); buf.append( s2); String cat = buf.toString(); instead of: String cat = s1 + s1; in their application code. (although I think that is pretty much what the compiler generates on your behalf, anyway) The loop is in the benchmark so I don't have to write code dealing with many different string values of differing size manually.