Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Brighten Godfrey <pbg@c...>
Subject: Strange performance bug
Hi,

I've encountered a very odd performance problem which I suspect is not  
a bug in my code.  Could it be the compiler, or maybe PCRE?

Here's the story.  I'm parsing a file (using the PCRE library in one  
step).  It goes quickly.  When I parse the same file a second time, it  
goes an order of magnitude more slowly.  Using Str instead of PCRE  
fixes the problem, but I'm not ready to blame PCRE, because various  
other minor changes make the problem disappear too.  I have tried to  
strip this program down to the smallest possible, but it appears to be  
sensitive to the details of the code in ways that I wouldn't expect,  
so I couldn't make it as small as I'd like.

Entire package to reproduce the problem (unpack, make, then run "./ 
problem fast" or "./problem slow"):

	http://www.cs.berkeley.edu/~pbg/tmp/ocaml_performance_problem.tar.bz2

Just the code:

	http://www.cs.berkeley.edu/~pbg/tmp/problem.ml


In case it matters, I am running OCaml 3.11.0 on Mac OS X 10.5.6 on  
Intel.  The problem seems to happen with both ocamlc and ocamlopt.

Can anyone else reproduce this problem or figure out what is going  
on?  Am I doing something silly?

Thanks so much,
~Brighten