[Haskell-cafe] [ANN] FastPush 0.1.0.0

William Yager will.yager at gmail.com
Tue Jan 24 05:19:54 UTC 2017


In response to a bit of an obscure use case I had, I created this very
simple library which gives you a Monad with a single operation, `push :: a
-> m ()`. This operation pushes an item onto a stack (represented under the
hood by a mutable ST vector).

When you run the monad, you get the stack out as a vector.

The library is quite fast. It's about 2x faster than C++'s
std::vec::push_back compiled without optimizations, and about 40% as fast
as std::vec::push_back when compiled with G++ -O2. There's almost certainly
some low-hanging optimization fruit for anyone skilled at Haskell
optimizing.

The library is parametric over choice of mutable vector. You can use
Unboxed, Storable, or normal vectors.

I've even included a Push Monad Transformer based
on Control.Monad.ST.Trans, but that's almost certainly unsafe, per the
caveats listed in the Control.Monad.ST.Trans docs.

https://hackage.haskell.org/package/FastPush-0.1.0.0

https://github.com/wyager/FastPush/

Cheers,
Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170123/32512a9a/attachment-0001.html>


More information about the Haskell-Cafe mailing list