<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/01/1c1f2f0f451d19c581c4bdf0276d6994"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-01-05T01:05:00"
  subject="Re: [Caml-list] speed"
  prev="2003/01/cfbfbda8c795246f69950e2e8ea00083"
  next="2003/01/8822d3df66a08ab1cf8eb00f8fdaf3de"
  prev-in-thread="2003/01/82d94403680b52187ef16b17c0a53ee4"
  next-in-thread="2003/01/bf543fdffa5461b710cb9940d1260e33"
  prev-thread="2003/01/48b807e3da767c9c00767bf580dd3d3c"
  next-thread="2003/01/d89aa4bddc31c6f04c1b3b3cc50d0853"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] speed">
<msg 
  url="2003/01/564b13bda6a36ad2f6b58a1b2caae8b7"
  from="onlyclimb &lt;onlyclimb@1...&gt;"
  author="onlyclimb"
  date="2003-01-03T08:01:16"
  subject="[Caml-list] speed">
<msg 
  url="2003/01/6396a50720af493ebecfe69e70d65210"
  from="Clemens Hintze &lt;ml-ocaml@q...&gt;"
  author="Clemens Hintze"
  date="2003-01-03T11:40:04"
  subject="[Caml-list] Re: speed">
</msg>
<msg 
  url="2003/01/0c4ef0e894b828576d2829f4be49ccf7"
  from="Noel Welsh &lt;noelwelsh@y...&gt;"
  author="Noel Welsh"
  date="2003-01-03T11:47:56"
  subject="Re: [Caml-list] speed">
<msg 
  url="2003/01/5939290091b9aef1bbf2a819582f4646"
  from="Chet Murthy &lt;chet@w...&gt;"
  author="Chet Murthy"
  date="2003-01-03T12:46:02"
  subject="Re: [Caml-list] speed ">
</msg>
</msg>
<msg 
  url="2003/01/7f3e0f0d40f2c3480534632092c477ce"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-01-03T13:32:30"
  subject="Re: [Caml-list] speed">
<msg 
  url="2003/01/5feeb124e6be296bb910526dd7e54fa5"
  from="Chet Murthy &lt;chet@w...&gt;"
  author="Chet Murthy"
  date="2003-01-03T14:39:21"
  subject="Re: [Caml-list] speed ">
<msg 
  url="2003/01/1b59aa51ded51a144ef03855ffa0454f"
  from="Sven Luther &lt;luther@d...&gt;"
  author="Sven Luther"
  date="2003-01-03T14:53:44"
  subject="Re: [Caml-list] speed">
<msg 
  url="2003/01/0f323657ee94c6b6ec75dd120b80acc1"
  from="Erol Akarsu &lt;eakarsu@c...&gt;"
  author="Erol Akarsu"
  date="2003-01-03T15:30:13"
  subject="Re: [Caml-list] speed">
</msg>
</msg>
</msg>
<msg 
  url="2003/01/e671f63faa6e60a2d46808e7a5be3c21"
  from="Chet Murthy &lt;chet@w...&gt;"
  author="Chet Murthy"
  date="2003-01-03T14:40:28"
  subject="Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/84db8a13e8a42079be430c11235ea1b0"
  from="Shawn Wagner &lt;shawnw@s...&gt;"
  author="Shawn Wagner"
  date="2003-01-03T15:02:10"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/99cd8b7b3ca0d9d001871a37a4eba80f"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2003-01-03T15:56:32"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/cfbfbda8c795246f69950e2e8ea00083"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-01-04T18:31:20"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/07ee33d3bd5bd0038b30b98207b154b7"
  from="Oleg &lt;oleg_inconnu@m...&gt;"
  author="Oleg"
  date="2003-01-18T22:50:01"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/17988bbd59483df8228db980cf6789fe"
  from="Shawn Wagner &lt;shawnw@s...&gt;"
  author="Shawn Wagner"
  date="2003-01-18T23:40:31"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/740ca05b3cb0c3e686a3998768c3564e"
  from="David Chase &lt;chase@w...&gt;"
  author="David Chase"
  date="2003-01-20T21:23:26"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/9237a1295600c54fc49c20a8c1967a3f"
  from="Nickolay Semyonov-Kolchin &lt;snob@s...&gt;"
  author="Nickolay Semyonov-Kolchin"
  date="2003-01-20T23:51:44"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/17b1dc91d01127781c5512160ebe2b0a"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-01-21T00:45:26"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/16f3332b61c5c9621ff8ca3d298d6272"
  from="David Chase &lt;chase@w...&gt;"
  author="David Chase"
  date="2003-01-21T13:09:12"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
<msg 
  url="2003/01/3e8e2b27f149125d2bc79f8f81f7238e"
  from="Daniel Andor &lt;da209@c...&gt;"
  author="Daniel Andor"
  date="2003-01-21T13:16:48"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/f781fbd10809682f5020b87923bff572"
  from="Nickolay Semyonov-Kolchin &lt;snob@s...&gt;"
  author="Nickolay Semyonov-Kolchin"
  date="2003-01-22T07:22:18"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/01/2e377a963ff1b981e10398add3c66047"
  from="Siegfried Gonzi &lt;siegfried.gonzi@s...&gt;"
  author="Siegfried Gonzi"
  date="2003-01-19T09:43:32"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/74a07e460d4553cfd41d33453e245700"
  from="Siegfried Gonzi &lt;siegfried.gonzi@s...&gt;"
  author="Siegfried Gonzi"
  date="2003-01-19T09:45:19"
  subject="Re: Coyote Gulch test in Caml (was Re: [Caml-list] speed )">
</msg>
<msg 
  url="2003/01/826f0fbaad9a50b70a73bc0e8f5f0fde"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-01-21T09:56:51"
  subject="[Caml-list] Re: Coyote Gulch test in Caml">
<msg 
  url="2003/01/eea86615e9ca47c169bfb91694fa15f2"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-01-21T15:48:19"
  subject="Re: [Caml-list] Re: Coyote Gulch test in Caml">
</msg>
<msg 
  url="2003/01/32a48fbbe8cc060ff33f9088ef0b64c6"
  from="Daniel Andor &lt;da209@c...&gt;"
  author="Daniel Andor"
  date="2003-01-27T16:59:52"
  subject="Re: [Caml-list] Re: Coyote Gulch test in Caml">
<msg 
  url="2003/01/82d94403680b52187ef16b17c0a53ee4"
  from="Christian Lindig &lt;lindig@e...&gt;"
  author="Christian Lindig"
  date="2003-01-30T07:41:25"
  subject="Re: [Caml-list] Re: Coyote Gulch test in Caml">
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/01/1c1f2f0f451d19c581c4bdf0276d6994"
  from="Brian Hurt &lt;brian.hurt@q...&gt;"
  author="Brian Hurt"
  date="2003-01-05T01:05:00"
  subject="Re: [Caml-list] speed">
<msg 
  url="2003/01/bf543fdffa5461b710cb9940d1260e33"
  from="Michael Vanier &lt;mvanier@c...&gt;"
  author="Michael Vanier"
  date="2003-01-05T20:17:34"
  subject="Re: [Caml-list] speed">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>

Woo hoo.  Language advocacy with benchmarks again.

Feel free to replace this whole post with a comment about "lies, damned 
lies, and cross language benchmarks".  It amounts to the same thing.

On Fri, 3 Jan 2003, Xavier Leroy wrote:

&gt; &gt; Is it normal that my ocaml program is only 2 times faster than the java 
&gt; &gt; counterpart ?(using the same method and complied into native. jdk is 1.4.1
&gt; 
&gt; You know, many compiler researchers would kill their whole families to
&gt; get speedups by a factor of 2 :-)
&gt; 
&gt; James Gosling gave a talk at INRIA recently where he repeated the
&gt; party line that JDK 1.4 runs as fast, or even faster, than C++.

Quibble #1: *what* C++?  Most of the time, when I see C++ benchmarked,
what's really being benchmarked is C compiled with a C++ compiler, or at
most C with classes.  My experience with C++ tells me that if you actually
use the features of C++- RTTI, templates, STL, exceptions, operator
overloading, etc- the code you produce is often much *slower* than Java.  
With a language as feature rich/bloated as C++, which subset of the
language you use makes a huge difference in your performance.  Ocaml has
the same problem in a lot of ways.

Quibble #2: define "equivelent program".

&gt; So, by transitivity, you're implying that OCaml is twice as fast as C++.
&gt; Yippee! 
&gt; 
&gt; More seriously: Java is nowhere as fast as a good C++ compiler (see
&gt; e.g. http://www.coyotegulch.com/reviews/almabench.html for an
&gt; independent, cross-language benchmark in numerical computing),

I note the coyote gulch benchmark shows IBM's Java to be more-or-less on
par with GCC 3.2.  I note, btw, that GCC 3.2 is signifigantly better at
optimization than GCC 2.9x, producing code about 10% faster on average
IIRC according to the GCC maintainers themselves.  Which tells me that
IBM's Java *is* better than GCC 2.9x.  Which is still the most commonly
used compiler on Linux systems.  Ditto for Windows.  My own experience and
tests show me that MS VC++ 6.0 is no better than, and in many cases worse
than, GCC 2.9x for optimization.

&gt; but it's not that slow either.  A factor of 2 slower than ocamlopt
&gt; sounds broadly reasonable, especially if the program doesn't stress
&gt; the GC too much.  Bagley's shootout (http://www.bagley.org/~doug/shootout/)
&gt; seems to suggest a larger factor (JDK 1.3 slightly slower than OCaml
&gt; bytecode), but his figures may be lowered by Java's slow start-up times.

Startup costs dominate in Bagley's shootout.  Look at matrix 
multiplication- the fastest tests (C, C++, and Ocaml) are running in 
70-110 milliseconds.  Most timers are accurate only to ~10 milliseconds, 
which means the time for the C program to run could be anything from 
600 millisecond to 800 milliseconds, for an error of +/-14.3%.

Java has huge start up costs.  First off, you have the JIT.  Then, there 
is a time delay before hotspot kicks in an actually starts optimizing the 
code to any signifigant extent.  Notice that the pro-Java benchmarks run 
the code to be benchmarked a few thousands or tens of thousands of times 
before starting the timer, so that the hotspot optimizer has already been 
over the code a couple of times.  Or at least once, to bypass JIT time.   
Is this a legitimate tactic?  Lies, damned lies, and cross-language 
benchmarks.

Note that I can also claim, with a straight face, that Ocaml is 5x 
*slower* than Java.  Take a look at Bagley's shootout on matrix 
multiplication, comparing byte-code interpreted Java with byte-code 
intepreted Ocaml.  Which is a much more apples to apples comparison.

Then there is the question of *future* performance of the languages.  In 
the pro-Java camp, I direct your attention to HP's Dynamo project:
http://www.arstechnica.com/reviews/1q00/dynamo/dynamo-1.html
http://www.hpl.hp.com/cambridge/projects/Dynamo/
which showed that a virtual PA-RISC emulator could run the code up to 20%
faster than running the same code native.  In the pro-Ocaml camp, Caml's
innate ease of reasoning about code open up, I think, a much larger array
of potiental optimizations for the compiler.

Of course, Java, Ocaml, and C++ all pale in comparison to the performance 
of hand-tuned assembly language.  Ergo, anyone who is using performance of 
the generated code as the primary reason for picking a language should, by 
all logic, be coding in assembly language.

Note that I, personally, think that performance should be the last reason 
used to pick a language.  Things like correctness of the code, available 
libraries and environments, and existing talents and skills of the 
workforce, should instead take precedence.

Brian


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners

</contents>

</message>

