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=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id DF6B9BBAF for ; Thu, 24 Jul 2008 18:38:31 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AucAAARNiEiYToBqhWdsb2JhbACSVAEBAQoECQcRBZ41 X-IronPort-AV: E=Sophos;i="4.31,247,1215381600"; d="scan'208";a="27644699" Received: from mailgate5.iss.soton.ac.uk ([152.78.128.106]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 Jul 2008 18:38:31 +0200 Received: from [152.78.96.56] (alpha.kk.soton.ac.uk [152.78.96.56]) (authenticated bits=0) by mailgate5.iss.soton.ac.uk (8.13.8/8.13.4) with ESMTP id m6OGbwv5015255 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 24 Jul 2008 17:37:59 +0100 Message-ID: <4888AFE6.8060108@soton.ac.uk> Date: Thu, 24 Jul 2008 17:37:58 +0100 From: "Dr. Thomas Fischbacher" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060607 Debian/1.7.12-1.2 X-Accept-Language: en MIME-Version: 1.0 To: Raj Bandyopadhyay Cc: "caml-list@yquem.inria.fr" Subject: Re: [Caml-list] Array copying in OCaml References: <4888AE76.2030204@rice.edu> In-Reply-To: <4888AE76.2030204@rice.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-3.0 (mailgate5.iss.soton.ac.uk [152.78.128.106]); Thu, 24 Jul 2008 17:37:59 +0100 (BST) X-ISS-MailScanner-Information: Please contact Serviceline@soton.ac.uk for more information X-ISS-MailScanner: Found to be clean X-ISS-MailScanner-SpamCheck: X-Spam: no; 0.00; ocaml:01 ocaml:01 arrays:01 blit:01 semantics:01 wrote:01 caml-list:01 functions:01 data:02 seems:03 library:03 raj:05 intermediate:05 trick:06 haven't:09 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. Are you sure there is no way delaying copying to the latest possible time (e.g. by introducing an intermediate array to which you copy data and which you use until you know for sure that you will have to hold on to your copy)? -- best regards, Thomas Fischbacher t.fischbacher@soton.ac.uk