English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

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 (10:37)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] ocamlopt speed (was Re: Module recursion)
> On Tue, Mar 18, 2003 at 06:34:29PM -0800, Chris Hecker wrote:
>> 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),
> My experience shows that ocaml code is very often twice (or more) as
> short as C equivalent. For example for language shootout sources:
> language        loc
> ~~~~~~~~~~~~~~~~~~~
> ansic:         1403
> cpp:           1107
> ml:             646
> Of course one may argue, that for bigger programs C gets less verbose
> (once you have written lists, hash tables, trees etc).
>> 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.
> In case of C compiler you should enable precompiled headers (if it
> supports one), because ocaml compiler uses some form of it.
>> compiler      sec    loc  loc/sec
>> ------------  ---  -----  -------
>> msvc6          12  27865     2322
>> ocamlopt       13  15483     1191
>> ocamlopt.opt    7  15483     2211
> Combined with semantic density, this makes ocamlopt twice as fast as
> msvc.

Sorry that I must say that, but these comparisons are absolutely
nonsense. I have some ocaml sources that are _much_ slower (e.g.
2500 lines, but compilations take longer than 20 seconds), and I know
that you can slow down C++ compilers by turning on optimization
switches. So the question arises: which features take which time?

My impression is that some type inference tasks can be very slow
for ocaml, especially if subtyping is involved. This feature is not
available in C++. On the other hand, C++ compilers usually implement
better optimization techniques, and these take time, too.

Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de

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