Simon Marlow simonmar at microsoft.com
Mon May 17 16:19:05 EDT 2004

On 17 May 2004 15:15, Daan Leijen wrote:

>>> When I omitted the "!" in " !k a !(Map k a) !(Map k a)"
>>> time was faster but page faults increased:
>>> Map-only:   7.37    29767
>> You should measure this version, because it is closer to what
>> FiniteMap does (plus there seems to be no good reason to force
>> strictness on the elements in a general purpose Map type).
> I agree with this. Note however that this forced strictness on the
> *key* not the element. It is ok to force strictness on the key as
> they are evaluated anyway -- and that is why I am surprised to see a
> speedup :-) 

Oops, good point.  DData.Map isn't strict in the elements, I misread it.

It is possible that being strict in the key is slower, if it introduced
extra unnecessary evals.  eg. if at the point at which the Map
constructor is built, the compiler couldn't figure out that the key was
already evaluated, it would have to eval it again.  This is probably
what happened. 


More information about the Libraries mailing list