purescript-deprecated/purescript-maps

foldl without materializing a list

Closed this issue · 2 comments

solves #134

This gives over a 10x speed improvement on larger maps (compare branch https://github.com/matthewleon/purescript-maps/tree/foldl-bench):

before

foldl: midsize map (10000)
mean   = 24.36 ms
stddev = 1.59 ms
min    = 22.57 ms
max    = 31.34 ms
foldl: big map (1000000)
mean   = 3.90 s
stddev = 143.96 ms
min    = 3.75 s
max    = 4.25 s

after

foldl: midsize map (10000)
mean   = 2.32 ms
stddev = 485.38 μs
min    = 2.04 ms
max    = 5.29 ms
foldl: big map (1000000)
mean   = 249.78 ms
stddev = 64.46 ms
min    = 226.67 ms
max    = 433.12 ms

Nice! Did you mean to open a PR?

ugh, moving this to a PR, not an issue.