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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id B3CFFBBAF for ; Thu, 24 Jul 2008 19:25:43 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnUAAERYiEjBvsFKnWdsb2JhbACSVAEBAQEBCA0Hnwg X-IronPort-AV: E=Sophos;i="4.31,247,1215381600"; d="scan'208";a="15463737" Received: from dnsp.umh.ac.be (HELO hermes1.umh.ac.be) ([193.190.193.74]) by mail1-smtp-roc.national.inria.fr with ESMTP; 24 Jul 2008 19:25:43 +0200 Received: from poincare.swapping.umh.ac.be ([10.102.100.10]) by hermes1.umh.ac.be (8.14.2/8.13.6) with ESMTP id m6OHNfXF4096248; Thu, 24 Jul 2008 19:23:41 +0200 Received: from localhost ([127.0.0.1] ident=trch) by poincare.swapping.umh.ac.be with esmtp (Exim 4.69) (envelope-from ) id 1KM4Yx-0003i6-6u; Thu, 24 Jul 2008 19:25:11 +0200 Date: Thu, 24 Jul 2008 19:25:11 +0200 (CEST) Message-Id: <20080724.192511.536327182490021702.Christophe.Troestler+ocaml@umh.ac.be> To: rajb@rice.edu Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Array copying in OCaml From: Christophe TROESTLER In-Reply-To: <4888AE76.2030204@rice.edu> References: <4888AE76.2030204@rice.edu> X-Face: #2fb%mPx>rRL@4ff~TVgZ"<[:,oL"`TUEGK/[8/qb58~C>jR(x4A+v/n)7BgpEtIph_neoLKJBq0JBY9:}8v|j Organization: University of Mons-Hainaut X-Mailer: Mew version 6.0.51 on Emacs 22.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.64 on 193.190.193.76 X-Spam: no; 0.00; ocaml:01 christophe:01 troestler:01 christophe:01 troestler:01 ocaml:01 arrays:01 blit:01 semantics:01 arrays:01 cheers:01 sourceforge:01 wrote:01 caml-list:01 functions:01 On Thu, 24 Jul 2008 11:31:50 -0500, Raj Bandyopadhyay wrote: > > I have an application which copies a lot of (small) OCaml arrays > using the Array library (Array.sub and Array.blit) functions. This > is turning out to be extremely expensive. > > Is there any general way/trick to reduce the cost of this kind of > operation? I haven't found a way not to copy as much, because the > program semantics seems to demand it. That all depends on the set of operations you want to support on these arrays. For example, if all you want is access, concatenation and slices, then an approach like the Rope library [1] may be envisioned. What is the problem you want to solve? Cheers, C. [1] http://ocaml-rope.sourceforge.net/