Version française
Home     About     Download     Resources     Contact us    
Browse thread
Array copying in OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dr. Thomas Fischbacher <t.fischbacher@s...>
Subject: Re: [Caml-list] Array copying in OCaml

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