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 (06:27)
From: Brighten Godfrey <pbg@c...>
Subject: Re: [Caml-list] Strange performance bug

On Apr 28, 2009, at 11:18 PM, Alain Frisch wrote:

> Brighten Godfrey wrote:
>> (Changing to the precompiled regexp does make this bug go away --  
>> but so do many other small changes, like commenting out the last  
>> line of the code, *after* the parsing is complete.)
> This last line (List.length first) + ...) forces the values first,  
> second and third to remain alive. How big are these values in memory?
> I would suggest to look closely at the memory usage and GC behavior  
> of your program. I did not investigate your problem, so here is a  
> random speculation: If the parsed file is big enough, PCRE will  
> compile a lot of regexps; maybe the OCaml PCRE binding does not  
> evaluate properly the memory usage of these regexps and so OCaml  
> does not trigger a GC soon enough to release the compiled regexps;  
> the process memory grows and the OS starts to swap your process.

That occurred to me too, but there is no swapping.  The process uses  
less than 40 MB of memory.  Also, this wouldn't explain why it  
suddenly becomes slow exactly when it starts parsing the file the  
second time.