Re: Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-14 Thread Duncan Coutts
On Fri, 2009-03-13 at 20:30 +0300, Bulat Ziganshin wrote: > Hello Don, > > Friday, March 13, 2009, 8:08:57 PM, you wrote: > > >> What is the reason why you have decided to use unpinned arrays > >> (ByteArray#) instead of pinned arrays (Foreign.Ptr)? > > > They prevent heap fragmentation (and in

Re: Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-14 Thread Duncan Coutts
On Tue, 2009-03-10 at 23:55 +0300, Bulat Ziganshin wrote: > starting with 6.6, ForeignArray access is no-op, so we can just use > obvious Ptr operations (via Storable class) to get unboxed arrays fast > access. so, no more need for those special ByteArray# access operations > > but Array library

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-13 Thread Bulat Ziganshin
Hello Don, Friday, March 13, 2009, 8:08:57 PM, you wrote: >> What is the reason why you have decided to use unpinned arrays >> (ByteArray#) instead of pinned arrays (Foreign.Ptr)? > They prevent heap fragmentation (and in general are faster). you probably mean faster alloc/gc operations, everyt

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Wednesday, March 11, 2009, 12:48:35 AM, you wrote: >> unfortunately, Array library unboxed arrays still aren't based on any >> Unboxable *class* > Hmm. Aren't all the array library types based on MArray and IArray? > So I can define my own say, new STUArray element type by writing an

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Xiao-Yong, Wednesday, March 11, 2009, 12:28:45 AM, you wrote: > It goes beyond my current knowledge, now. How do you define > a custom data type as an instance of UA or Storable? just look at existing instances. basically, for complex data type, you just use instances for its basic types,

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Wednesday, March 11, 2009, 12:12:07 AM, you wrote: > Right, so my point stands: there's no difference now. If you can write a > Storable instance, you can write a UA et al instance. yes, if there is some class provided for this and not just hard-coded 4 or so base types > And GHC 6.

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Xiao-Yong, Tuesday, March 10, 2009, 11:52:50 PM, you wrote: > So it's me who understand it wrong. If I want some high > performance array with elements of custom data type, I'm > stuck with Array, anyway? ForeignArray will be the best here. just make you type instance of Storable. if you

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Tuesday, March 10, 2009, 11:01:31 PM, you wrote: >> if uavector use ghc's built-in unboxed array operations (as >> Data.Array.Unboxed does) then it's necessarily bounded to types >> supported by those operations > And what is Storable limited to? > Ultimately they're all limited to t

Re[2]: [Haskell-cafe] bytestring vs. uvector

2009-03-10 Thread Bulat Ziganshin
Hello Don, Tuesday, March 10, 2009, 10:40:30 PM, you wrote: >> I think uvector only works with certain types that can be >> unboxed, while storablevector works with all types that >> instantiate Foreign.Storable.Storable. I don't know about >> vector. From the description of vector, I have the