Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Florian Hars <hars@bik-gmbh.de>
To: Oliver Bandel <oliver@first.in-berlin.de>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Slow... very slow...
Date: Fri, 07 Feb 2003 09:03:28 +0100	[thread overview]
Message-ID: <3E436850.4050300@bik-gmbh.de> (raw)
In-Reply-To: <20030207010851.GA617@first.in-berlin.de>

Oliver Bandel wrote:
> Why is the Ocaml-program so slow,

The tool of choice if you don't understand where your program spends it's time 
isn't mutt, but gprof or ocamlprof.

The main problem may be here:

>    let firstsplit = Str.bounded_split (Str.regexp "[ \t]+") line 3

If Str.regexp is implemented in the same way as Pcre.regexp (where I first 
encountered this problem), the compiler regards the call to the external C 
library prividing the regexp code as an unsafe operation that may have side 
effects and so must be repeated on every invocation of Str.bounded_split.
Try moving it to the toplevel:

let tabre = Str.regexp "[ \t]+"

and then change all your functions to use it like:

     let firstsplit = Str.bounded_split tabre line 3

Yours, Florian.

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


      reply	other threads:[~2003-02-07  8:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-07  1:08 Oliver Bandel
2003-02-07  8:03 ` Florian Hars [this message]

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=3E436850.4050300@bik-gmbh.de \
    --to=hars@bik-gmbh.de \
    --cc=caml-list@inria.fr \
    --cc=oliver@first.in-berlin.de \
    /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