From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 097D5BC6B for ; Mon, 11 Feb 2008 10:59:26 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAPaqr0fAXQImh2dsb2JhbACQOQEBAQgKKZYt X-IronPort-AV: E=Sophos;i="4.25,332,1199660400"; d="scan'208";a="7154478" Received: from discorde.inria.fr ([192.93.2.38]) by mail2-smtp-roc.national.inria.fr with ESMTP; 11 Feb 2008 10:59:26 +0100 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m1B9xPmj005869 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Mon, 11 Feb 2008 10:59:25 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAEKrr0eBrw8Eh2dsb2JhbACQOQEBAQgKKZYu X-IronPort-AV: E=Sophos;i="4.25,332,1199660400"; d="scan'208";a="22461721" Received: from ext.lri.fr ([129.175.15.4]) by mail4-smtp-sop.national.inria.fr with ESMTP; 11 Feb 2008 10:59:25 +0100 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id 162D3A491E; Mon, 11 Feb 2008 10:59:25 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lri.fr Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r1NMbhZIpAuQ; Mon, 11 Feb 2008 10:59:24 +0100 (CET) Received: from [129.175.4.117] (lri4-117 [129.175.4.117]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ext.lri.fr (Postfix) with ESMTP id EA5A3A48FE; Mon, 11 Feb 2008 10:59:24 +0100 (CET) Message-ID: <47B01D01.7040509@lri.fr> Date: Mon, 11 Feb 2008 11:01:37 +0100 From: =?ISO-8859-1?Q?Jean-Christophe_Filli=E2tre?= User-Agent: Thunderbird 1.5.0.14pre (X11/20071023) MIME-Version: 1.0 To: Vincent Hanquez Cc: Oliver Bandel , caml-list@inria.fr Subject: Re: [Caml-list] Now it's faster (addendum to "Performance-question") References: <1202297628.47a99b1c7ec53@webmail.in-berlin.de> <1202298904.47a9a018998e4@webmail.in-berlin.de> <20080206120403.GA5335@snarc.org> In-Reply-To: <20080206120403.GA5335@snarc.org> X-Enigmail-Version: 0.94.2.0 OpenPGP: url=http://www.lri.fr/~filliatr/mykey.asc Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 47B01C7D.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; filliatre:01 filliatre:01 lri:01 buffer:01 buffer:01 ocaml's:01 ocaml:01 integers:01 lri:01 filliatr:01 ocaml:01 mli:01 filliatr:01 wrote:01 wrote:01 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