IntSet.findMax generates garbage

Scott Dillard sedillard at ucdavis.edu
Thu May 22 14:15:16 EDT 2008


Hi,

I noticed IntSet.findMax is defined (more or less) as "fst . maxView",
but maxView allocates thunks on its way down to the max leaf, only to
have findMax throw them away. Same for IntMap. I wrote a patch to fix
this. I didn't test it for speed (couldn't think of a good test. I did
test for correctness.) However, I looked at the core and the old
version did indeed have "let"s in the loop. The new version does not.
Also I changed the API a bit. Previously, IntMap.findMin only returned
the bound value, not the key. Data.Map returns the pair, so I changed
IntMap to do the same. (This seems like common sense to me.)

Patch is attached. Can you tell I'm using this library a lot lately?

Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: findMinMax.patch
Type: text/x-diff
Size: 69329 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/libraries/attachments/20080522/7f5c9909/findMinMax-0001.bin


More information about the Libraries mailing list