unique identifiers as a separate library
iavor.diatchki at gmail.com
Mon Dec 22 18:35:50 EST 2008
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
On Mon, Dec 22, 2008 at 3:27 AM, Sebastian Fischer
<sebf at 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
>> 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
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
More information about the Glasgow-haskell-users