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 <[EMAIL PROTECTED]> 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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to