Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] OCaml popularity
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-03-19 (02:39)
From: Chris Hecker <checker@d...>
Subject: [Caml-list] ocamlopt speed (was Re: Module recursion)

Christophe Troestler contacted me off list to ask about this comment from 
one of my mails:

>especially since the native compiler is a bit pokey (6x slower than a C++ 
>compiler for same LOC last time I checked)

Christophe asked if I was using ocamlopt.opt or ocamlopt.  I said I thought 
I was using the latter but that I'd check and post back to the list.

It turns out I was using ocamlopt (the bytecode build of the native code 
compiler).  I had built the .opt versions but not switched over to them (I 
was using camlp4o.opt where I was using camlp4, though).  I switched and it 
got almost twice as fast, which is very nice.  I also retimed the C project 
that I was informally comparing to, and the timings on this machine (laptop 
with very fast cpu, very slow hard drive) are quite different than the 
other machine I originally tested on (desktop with slow cpu, fast hard 
drive, or I made a mistake on that machine, which is more than 
possible).  I will retime things there as well when I go to the office.

Here are the results on this machine, which shows ocamlopt.opt just about 
matching msvc6.  This isn't trying to be a formal test, so I don't account 
for things like the difference in code complexity (they're both games), 
system headers included in C files (which would favor C if they were 
cleaned up) or the fact that my makefile for caml doesn't pass multiple ml 
files to the compiler (which should favor ocamlopt), etc.

compiler      sec    loc  loc/sec
------------  ---  -----  -------
msvc6          12  27865     2322
ocamlopt       13  15483     1191
ocamlopt.opt    7  15483     2211


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: