caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: Brighten Godfrey <pbg@cs.berkeley.edu>
Cc: Damien Doligez <damien.doligez@inria.fr>,
	OCaml List <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Strange performance bug
Date: Wed, 29 Apr 2009 15:38:53 -0400	[thread overview]
Message-ID: <f8560b80904291238v4a202e23gfda4e4ff0807bc0@mail.gmail.com> (raw)
In-Reply-To: <25CD1992-3F33-4AEA-97A3-EC54729EC4FE@cs.berkeley.edu>

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.

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


  reply	other threads:[~2009-04-29 19:39 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
2009-04-29 16:03                 ` Markus Mottl
2009-04-29 19:19                   ` Brighten Godfrey
2009-04-29 19:38                     ` Markus Mottl [this message]
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=f8560b80904291238v4a202e23gfda4e4ff0807bc0@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=damien.doligez@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).