> >     mistral-jerome:/tmp > time python test.py
> >     python test.py  2,59s user 0,00s system 100% cpu 2,582 total
> >     mistral-jerome:/tmp > ocamlc -o tst test.ml; time ./tst
> >     ./tst  0,14s user 0,00s system 106% cpu 0,131 total
> >     mistral-jerome:/tmp > cat test.ml
> >     let foo () = () in
> >     for i = 1 to 1000000 do foo () done
> 
> That is impressive. I don't know Ocaml but do you think there is an
> optimization being done since foo takes no args, returns not values and has
> an empty body?

This also isn't a fair comparison.

python is compiling test.py to bytecode during the 'time' call.  

ocaml is explicitly compiling _to a raw executable_ (and optimizing at
three different levels) outside the call.  There's no startup overhead
for the binary.

Also, (in general) for this kind of test you really need to run each a
lot of times and average.  There's too many things going on on a
typical system that could tweak things.

-R

Reply via email to