[Haskell-cafe] Array, Vector, Bytestring
carter.schonwald at gmail.com
Tue Jun 4 22:34:10 CEST 2013
I really don't understand this concern.
These libraries are tuned for wildly different workloads and use cases, so
these sorts of micro benchmarks are an Apples to Frogs comparisons.
(even aside from the fact that you'll get very different perf if you used
-fllvm and set things up so the array indexing and associated loop code get
inlined and fused together!)
what is the actual concern? Strawman micro benchmarks that don't even
compare the respective libraries for their intended use cases seeems....
On Tue, Jun 4, 2013 at 12:49 PM, silvio <silvio.frischi at gmail.com> wrote:
> Just to clarify for those on the sidelines, the issue is duplication of
>> implementation details, rather than duplication of functionality?
> Well to me, that is not the main issue. The main issue is that you have to
> study all of them and depending on which libraries you want to use have to
> convert between them, which could be expensive and is definitely annoying.
> I made a few simple benchmarks comparing the three libraries you can find
> the code attached.
> this is compiled with -O2
> # simple sum of 1000000 Word8 elements
> Unboxed Vector 1.114060 ms
> Storable Vector 795.1207 us
> Primitive Vector 1.116145 ms
> ByteString 9.076256 ms
> array library has no fold or sum function
> # simple sum of 1000000 more or less randomly chosen elements
> Unboxed Vector (unsafe) 33.74364 ms
> Storable Vector (unsafe) 50.27273 ms
> Storable Vector (safe) 67.01634 ms
> Primitive Vector (unsafe) 56.29919 ms
> ByteString (unsafe) 19.29611 ms
> ByteString (safe) 18.29065 ms
> UArray (safe) 46.88719 ms
> unsafe does not exist for array
> So Unboxed can be better than Storable but doesn't need to be.
> Also, which implementation is faster depends very much on the problem at
> hand. And array is just missing half the needed features.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe