caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Jean-Christophe Filliâtre" <Jean-Christophe.Filliatre@lri.fr>
To: Vincent Hanquez <tab@snarc.org>
Cc: Oliver Bandel <oliver@first.in-berlin.de>, caml-list@inria.fr
Subject: Re: [Caml-list] Now it's faster (addendum to "Performance-question")
Date: Mon, 11 Feb 2008 11:01:37 +0100	[thread overview]
Message-ID: <47B01D01.7040509@lri.fr> (raw)
In-Reply-To: <20080206120403.GA5335@snarc.org>

Vincent Hanquez wrote:
> the buffer library is actually pretty bad since it's actually just a
> simple string. each time the buffer need to grow, the string is
> reallocated and the previous one is copied to the new string.
> and you got the 16mb limit (max_string_length) on 32bit.

Just for fun, I wrote a ropes-based implementation of Buffer. The
interface is exactly the same. Differences between the two
implementations are the following:

 - Contrary to ocaml's standard library, a buffer size is not limited to
      [Sys.max_string_length], but to [max_int] (sizes are represented
      internally using native ocaml integers).

 - [contents] and [sub] raise [Invalid_argument] if the resulting string
      would be larger than [Sys.max_string_length] bytes.

 - The meaning of [create]'s argument is not exactly the same,
    though its value only affects performances, as for [Buffer];
    see below.

 - An additional function [print] is provided.

The code is here:

	http://www.lri.fr/~filliatr/ftp/ocaml/ds/rbuffer.mli
	http://www.lri.fr/~filliatr/ftp/ocaml/ds/rbuffer.ml

For general-purpose ropes, see

	http://www.lri.fr/~filliatr/software.en.html

-- 
Jean-Christophe


  parent reply	other threads:[~2008-02-11  9:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-06 11:33 Oliver Bandel
2008-02-06 11:55 ` [Caml-list] " Oliver Bandel
2008-02-06 12:04   ` Vincent Hanquez
2008-02-07  9:55     ` David Teller
2008-02-09 10:03       ` Oliver Bandel
2008-02-09 10:29         ` David Teller
2008-02-09 10:18     ` Oliver Bandel
2008-02-11 12:36       ` Vincent Hanquez
2008-02-11 10:01     ` Jean-Christophe Filliâtre [this message]
2008-02-11 12:41       ` Vincent Hanquez
2008-02-11 14:34         ` Jean-Christophe Filliâtre
2008-02-11 14:51           ` Vincent Hanquez

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=47B01D01.7040509@lri.fr \
    --to=jean-christophe.filliatre@lri.fr \
    --cc=caml-list@inria.fr \
    --cc=oliver@first.in-berlin.de \
    --cc=tab@snarc.org \
    /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).