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
work.

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
and
  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

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to