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] Memory management dominates running time
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-01-08 (01:57)
From: Chet Murthy <chet@w...>
Subject: Re: [Caml-list] Memory management dominates running time

By using gprof, and doing a little careful counting, you can 
often find out where egregious allocations are happening, and
eliminate them.

I can't give you good pointers on this, because, well, it's a bit of
an art, and takes a lot of experience.  But it _is_ doable, and I have
done it to nontrivial programs in Caml, as well as in Java, attaining
speedups of 2x, 3x, without much code-restructuring.

E.g., once, I took a Stream-based parser, and wrote a Stream module
which only supported "char Stream", and only for parsing.

By writing a few auxiliary functions in addition to this, I was able
to reduce the consing associated with stream-based parsing (the
constant creation of "Some _" blocks) significantly, and got a rather
large speedup.

I was able to see that this was important, basically by looking around
in the gprof profile and trying to follow where the allocation were

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