RE: major missing piece to arrays?

2004-07-20 Thread Simon Marlow
On 20 July 2004 02:23, John Meacham wrote: > Cool, I can build more efficient versions on these now that I know the > ByteArray# as Addr# trick. > > I am curious what the best way to go about writing specialized > versions is, > placing the copying functions in a class, with (slow) default method

Re: major missing piece to arrays?

2004-07-19 Thread Carsten Schultz
(I am not sure, if keeping the cc to libraries is ok, apologies in case it is not.) On Mon, Jul 19, 2004 at 06:23:21PM -0700, John Meacham wrote: > I am curious what the best way to go about writing specialized versions > is, > placing the copying functions in a class, with (slow) default method

Re: major missing piece to arrays?

2004-07-19 Thread John Meacham
On Tue, Jul 20, 2004 at 02:56:15AM +0200, Carsten Schultz wrote: > On Thu, Jul 15, 2004 at 04:26:27AM -0700, John Meacham wrote: > > I am thinking a family of routines. (with psuedosignatures) > > > > copySpan: range -> MArray -> whereto -> MArray -> m () > > extractSpan : range -> IArray -> IArra

Re: major missing piece to arrays?

2004-07-19 Thread Carsten Schultz
On Thu, Jul 15, 2004 at 04:26:27AM -0700, John Meacham wrote: > I am thinking a family of routines. (with psuedosignatures) > > copySpan: range -> MArray -> whereto -> MArray -> m () > extractSpan : range -> IArray -> IArray > extractSpanM : range -> MArray -> m IArray > saveSpan : range -> IArray

RE: major missing piece to arrays?

2004-07-19 Thread Simon Marlow
On 17 July 2004 01:47, John Meacham wrote: > so, ByteArray# seems to be equivalant to a raw pointer in speed, with > the advantage that it is garbage collected. > > however foreignptrs are twice as slow! and even slower than an IORef. Were you using mallocForeignPtr here? Or newForeignPtr? > a

Re: major missing piece to arrays?

2004-07-16 Thread John Meacham
On Fri, Jul 16, 2004 at 10:43:58AM +0100, Simon Marlow wrote: > > Also, in my tests, arrays implemented via ByteArray# or Ptr a seem to > > be signifigantly faster than those implemented via ForeignPtr. Is this > > expected? > > Yes, StorableArray suffers from this problem. Specialising the array

Re: major missing piece to arrays?

2004-07-16 Thread Shawn Garbett
--- Jérémy_Bobbio <[EMAIL PROTECTED]> wrote: > memcpy is available in Foreign.Marshal.Utils: > > copyBytes :: Ptr a -> Ptr a -> Int -> IO () > > Copies the given number of bytes from the > second area (source) > into the first (destination);the copied areas > may not overlap > > H

RE: major missing piece to arrays?

2004-07-16 Thread Simon Marlow
On 15 July 2004 22:08, John Meacham wrote: > On Thu, Jul 15, 2004 at 04:20:38PM +0200, Jérémy Bobbio wrote: >> memcpy is available in Foreign.Marshal.Utils: >> >> copyBytes :: Ptr a -> Ptr a -> Int -> IO () >> >> Copies the given number of bytes from the second area (source) >> in

Re: major missing piece to arrays?

2004-07-15 Thread John Meacham
On Thu, Jul 15, 2004 at 04:20:38PM +0200, Jérémy Bobbio wrote: > memcpy is available in Foreign.Marshal.Utils: > > copyBytes :: Ptr a -> Ptr a -> Int -> IO () > > Copies the given number of bytes from the second area (source) > into the first (destination);the copied areas may not

Re: major missing piece to arrays?

2004-07-15 Thread Jérémy Bobbio
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 15 juil. 04, at 13:26, John Meacham wrote: Perhaps I am just missing something, but a major piece of efficient array functionality seems to be missing. Namely the ability to efficiently copy spans of arrays into one another and/or compare spans of me

major missing piece to arrays?

2004-07-15 Thread John Meacham
Perhaps I am just missing something, but a major piece of efficient array functionality seems to be missing. Namely the ability to efficiently copy spans of arrays into one another and/or compare spans of memory. (basically memcpy and memcmp from C). any particular reason these basic building blo