Isaac Gouy wrote:
> (I'm not interested enough to find out, but I suspect stdout is at
> minimum line-buffered.)

Sure, the naive implementations in other languages are doing silly things as
well (like the OCaml flushing after every line) but they are still faster
than the most optimised Java to date.

>> Even when you do use buffers in Java, it is still slower than unbuffered
>> C++, OCaml etc. on my machine.
> 
> No where near an order of magnitude slower - iirc you reported 1.85x C

I get 0.604s unoptimised OCaml vs 1.740s unoptimised Java on x86_64. That's
2.9x slower.

>> I was using Sun's J2SE 1.5. I also tried GNU's GIJ, which is even slower
>> than OCaml's bytecode.
> 
> You failed the Java exam again :-)
>
> For Java without JIT use the -Xint command line option with the Sun JVM
> like this
> 
>    time java -Xint Latin > /dev/null

That's as slow as ocamlc.

> And if the program ran for any amount of time we of course be using
> 
>    time java -server Latin > /dev/null

I already tried and it improved performance slightly.

-- 
Dr Jon D Harrop, Flying Frog Consultancy
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists