[Haskell-cafe] Re: FPS: Finalizers not running (wasMemoryusageoutside of the Haskell heap)

Simon Marlow simonmar at microsoft.com
Thu Nov 10 12:05:18 EST 2005


On 10 November 2005 14:56, Jan-Willem Maessen wrote:

> On Nov 9, 2005, at 4:46 AM, Ketil Malde wrote:
> 
>> Sebastian Sylvan wrote:
>> 
>>> On 11/8/05, Jan-Willem Maessen <jmaessen at alum.mit.edu> wrote:
>>> 
>>>> Just wanted to let people know that I've been working on improving
>>>> Data.HashTable, with the help of Ketil Malde's badly performing
>>>> code 
>>>> 
>>>> 
>> Always happy to help, of course - bad performance R us:-)
> 
> I think that if I can get unsafeFreeze/unsafeThaw to work reliably,
> it'll finally outperform Data.Map on your example.  I haven't yet
> played with the hash function, which looks kind of bad; there may be
> hope for improvement there as well.
> 
>>> Request: Data.HashTable.Immutable
>>> 
>> I'm not sure you really want that - do you wish to copy a large
>> array each time you do an update?
>> Freezing and thawing might be a good idea, though.
> 
> A true read-only hash table, with a freeze for the mutable version,
> but NO THAW, could potentially be useful.  I seem to recall that hbc
> had an immutable hash table (along with a derivable Hashable class),
> where the content was specified as in an array comprehension.

The unsafeFreeze/unsafeThaw trick can be used to speed up DiffArrays,
which in turn could be used to provide a good immutable HashTable
implementation.  I'm pretty sure this would be a profitable approach.
It's possible that DiffArrays need more work than just
unsafeFreeze/unsafeThaw to make them efficient, though.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list