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

Jan-Willem Maessen jmaessen at alum.mit.edu
Thu Nov 10 09:55:33 EST 2005


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.

User-level Thaw is a bad idea, and I will resist it, even if the  
library ends up using Freeze/Thaw internally to work around GC  
shortcomings.

> HashTable's interface is rather impoverished, compared to Map and  
> even Array.
> Ideally, it should support many of the same operations, and  
> presumably it could work with the ST monad as well as IO.

It's certainly possible to code many of these up---the cleanest code  
I've gotten so far would even make it easy, as everything but lookup  
goes through 2 higher-order INLINE functions (a generic insert/delete  
and a map/reduce, each on a list of pairs).

But I'm going to focus for the moment on the most pressing need,  
which is acceptable performance for what we've got.  I hope the  
result will make new functionality easier to provide.

-Jan

>
> -k
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list