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
Strange performance bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-04-29 (14:48)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] Strange performance bug

On 2009-04-29, at 15:58, Markus Mottl wrote:

> Note that the effect of not precompiling the regular expressions is
> not just the overhead of this computation, but also vastly greater
> GC-pressure.
> The current GC-settings in Pcre will trigger a full GC-cycle every 500
> regular expressions allocated, i.e. would perform a full major
> collection every 500 lines in your case.  This setting works fine for
> just about any application I've seen, because virtually nobody has to
> create patterns dynamically at rates so high that this matters.

Markus, you put your finger right on the problem.  That program doesn't
suddenly start to get slow, it gets steadily slower as it runs.  The
heap also gets steadily bigger, and the major GC does way too much

Alain's explanation (about why changing the last line changes the
speed of the rest of the program) looks right to me.  When you remove
that last line, the GC still does too much work, but the heap doesn't
grow, so it doesn't get slower.

To see the problem, you should play with the GC verbosity settings,
for example, see the difference between
   OCAMLRUNPARAM=v=1 ./problem slow
   OCAMLRUNPARAM=v=1 ./problem fast

Maybe PCRE should change its settings to trigger GCs less often but,
as Markus said, this doesn't look really important.

-- Damien