caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: tab@snarc.org (Vincent Hanquez)
To: "Jean-Christophe Filliâtre" <Jean-Christophe.Filliatre@lri.fr>
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 15:51:29 +0100	[thread overview]
Message-ID: <20080211145129.GA13295@snarc.org> (raw)
In-Reply-To: <47B05CFA.80405@lri.fr>

On Mon, Feb 11, 2008 at 03:34:34PM +0100, Jean-Christophe Filliâtre wrote:
> With Rbuffer, the value passed to create is the size of each chunk in
> the rope (roughly), so passing a value such as 10 and then appending
> millions of characters will result in a lot of allocations for rope
> nodes, and will make Rbuffer less efficient than Buffer. But if you pass
> a value large enough, i.e. of the same order of magnitude as the size of
> the final buffer, then it should be as efficient as Buffer.

maybe in this case you should add a minimum limit, so that people
doesn't create rbuffer with 10 or something.

just a simple:
let create sz =
	let sz = max sz my_rbuffer_limit in

> > one nit, keeping compatibility is good, however, the contents function
> > is quite evil (runtime failure), and removing it would be nice as well.
> 
> I agree that a failure of "contents" can be surprising, but I don't like
> the idea of removing it at all (in particular because you may want to be
> able to substitute Rbuffer for Buffer in yours programs to compare
> efficiencies).

I don't really like removing it either, but people need to know that
contents (as in Rbuffer.t -> string) could be evil.

> > people should use other thing to "iterate" over the contents (even if
> > contents is quite practical)
> 
> do you mean something like "iter : t -> (char -> unit) -> unit"?
> 
> (It could be implemented more efficiently than a repeated use of "nth")

iterate in a broad sense; beeing able to do something with what's inside
the buffer.  it could be a list of string, chunks, char, etc ...

-- 
Vincent Hanquez


      reply	other threads:[~2008-02-11 14:51 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
2008-02-11 12:41       ` Vincent Hanquez
2008-02-11 14:34         ` Jean-Christophe Filliâtre
2008-02-11 14:51           ` Vincent Hanquez [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=20080211145129.GA13295@snarc.org \
    --to=tab@snarc.org \
    --cc=Jean-Christophe.Filliatre@lri.fr \
    --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;
as well as URLs for NNTP newsgroup(s).