<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 05/06/13 02:49, silvio wrote:<br>
    </div>
    <blockquote cite="mid:51AE1AB0.80405@gmail.com" type="cite">
      <blockquote type="cite">Just to clarify for those on the
        sidelines, the issue is duplication of
        <br>
        implementation details, rather than duplication of
        functionality?
        <br>
      </blockquote>
      <br>
      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.
      <br>
      <br>
      I made a few simple benchmarks comparing the three libraries you
      can find the code attached.
      <br>
      <br>
      this is compiled with -O2
      <br>
      <br>
      # simple sum of 1000000 Word8 elements
      <br>
      <br>
      Unboxed Vector&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.114060 ms
      <br>
      Storable Vector&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 795.1207 us
      <br>
      Primitive Vector&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.116145 ms
      <br>
      <br>
      ByteString&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9.076256 ms
      <br>
      <br>
      array library has no fold or sum function
      <br>
      <br>
      # simple sum of 1000000 more or less randomly chosen elements
      <br>
      <br>
      Unboxed Vector (unsafe)&nbsp;&nbsp;&nbsp; 33.74364 ms
      <br>
      Storable Vector (unsafe)&nbsp;&nbsp; 50.27273 ms
      <br>
      Storable Vector (safe)&nbsp;&nbsp;&nbsp;&nbsp; 67.01634 ms
      <br>
      Primitive Vector (unsafe)&nbsp; 56.29919 ms
      <br>
      <br>
      ByteString (unsafe)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 19.29611 ms
      <br>
      ByteString (safe)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18.29065 ms
      <br>
      <br>
      UArray (safe)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 46.88719 ms
      <br>
      unsafe does not exist for array
      <br>
      <br>
      So Unboxed can be better than Storable but doesn't need to be.
      <br>
      Also, which implementation is faster depends very much on the
      problem at hand. And array is just missing half the needed
      features.
      <br>
      <br>
      Silvio
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Haskell-Cafe mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a>
</pre>
    </blockquote>
    array does provide folding functions, found in its Foldable and
    Traversable instances.<br>
  </body>
</html>