caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien Doligez <damien.doligez@inria.fr>
To: OCaml List <caml-list@yquem.inria.fr>
Cc: Brighten Godfrey <pbg@cs.berkeley.edu>
Subject: Re: [Caml-list] Strange performance bug
Date: Wed, 29 Apr 2009 16:48:08 +0200	[thread overview]
Message-ID: <0FDD87FB-2461-4BBC-BDB1-5316A5AE4D23@inria.fr> (raw)
In-Reply-To: <f8560b80904290658p6f5cacb9vb6a2cec1c77359a4@mail.gmail.com>


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


  reply	other threads:[~2009-04-29 14:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29  2:43 Brighten Godfrey
2009-04-29  3:37 ` [Caml-list] " Markus Mottl
2009-04-29  4:31   ` Brighten Godfrey
2009-04-29  6:18     ` Alain Frisch
2009-04-29  6:27       ` Brighten Godfrey
2009-04-29  6:37         ` Alain Frisch
2009-04-29  8:29           ` Brighten Godfrey
2009-04-29 13:58             ` Markus Mottl
2009-04-29 14:48               ` Damien Doligez [this message]
2009-04-29 16:03                 ` Markus Mottl
2009-04-29 19:19                   ` Brighten Godfrey
2009-04-29 19:38                     ` Markus Mottl
2009-04-29 20:23                       ` Brighten Godfrey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0FDD87FB-2461-4BBC-BDB1-5316A5AE4D23@inria.fr \
    --to=damien.doligez@inria.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=pbg@cs.berkeley.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).