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 (20:23)
From: Brighten Godfrey <pbg@c...>
Subject: Re: [Caml-list] Strange performance bug
On Apr 29, 2009, at 12:38 PM, Markus Mottl wrote:

> On Wed, Apr 29, 2009 at 15:19, Brighten Godfrey  
> <pbg@cs.berkeley.edu> wrote:
>> You seem to have solved my problem.  But out of curiosity:  Do you  
>> know how
>> the GC settings in the Str library differ from PCRE's, and why?   
>> Why does
>> PCRE need to explicitly trigger GCs at all?
> Str regular expressions are pure OCaml-values, whereas PCRE regexps
> are allocated on the C-heap.  Since C-heap values need to be
> deallocated explicitly, a finalizer has to be installed that does the
> job if the OCaml-value is not reachable anymore.  The OCaml-runtime
> needs hints about how large these C-values are.  Otherwise it may not
> scan the OCaml-heap aggressively enough, leaving a lot of those
> C-values floating around and eating up your memory.
> Right now the PCRE-library guarantees that not more than 500 regular
> expressions will float around at any one time.  This can lead to
> considerable slowdowns if your OCaml-heap is large and you allocate
> regular expressions at very high rates.

Got it.  Thank you all for your replies!