Hi, Thanks for the feedback! I have uploaded a new version of value supply with the following changes that should improve performance. - It uses unsafeDupableInterleaveIO to avoid double locking, - Do not create an intermediate list for Enum and Num supples - Specialize code for Int, as this is the most commonly used type for new name generation.
These together should make things much faster but I have not had a chance to test that. I looked at the core and it seemed that the specializations were kicking in, so hopefully all is OK :) It would be great if you could let me know if things are still slower than the GHC version, and if so by how much. Also, I made a git-hub repo for the code, in case anyone is interested in contributing: http://github.com/yav/value-supply/tree/master -Iavor On Mon, Dec 22, 2008 at 3:27 AM, Sebastian Fischer <s...@informatik.uni-kiel.de> wrote: > Thanks for pointing me at Iavors package. We should not have two different > libraries for the same purpose. > > value-supply-0.2 is about 6-7 times slower than GHC's UniqSupply, but > porting Simons suggestion (to use unsafeDupableInterleaveIO) into Iavors > code, GHC is "only" about twice as fast. > > Can we do better? I tried to use SPECIALIZE INLINE pragmas (at > new[Enum|Num]Supply for Int) and/or strictness annotations (for the unique > value) without significant benefit. > > I like Iavors more general interface (polymorphic values) and that only > demanded identifiers are created. The latter saves half of the names when > evaluating > >> map supplyValue . split > > I will replace my dependency to ghc with one to value-supply if > unsafeDupableInterleaveIO is used instead of unsafeInterleaveIO where it is > available. > > Cheers, > Sebastian > _______________________________________________ > Glasgow-haskell-users mailing list > Glasgow-haskell-users@haskell.org > http://www.haskell.org/mailman/listinfo/glasgow-haskell-users > _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users