Skip to content

Improve fromList for IntSet and IntMap #1137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

meooow25
Copy link
Contributor

Implement a fusion-friendly version of the smarter algorithm proposed in #653.

For #1128.


Benchmarks on GHC 9.10.1:

IntSet:

Name                          Time - - - - - - - -    Allocated - - - - -
                                   A       B     %         A       B     %
fromList:asc                   46 μs   18 μs  -60%    480 KB  5.5 KB  -98%
fromList:asc:fusion            39 μs  4.1 μs  -89%    480 KB  5.5 KB  -98%
fromList:asc:sparse            95 μs   47 μs  -50%    864 KB  352 KB  -59%
fromList:asc:sparse:fusion     87 μs   41 μs  -52%    864 KB  352 KB  -59%
fromList:random               459 μs  467 μs   +1%    1.5 MB  2.4 MB  +67%
fromList:random:fusion        450 μs  459 μs   +1%    1.5 MB  2.4 MB  +67%
fromList:randomDups            57 μs   48 μs  -16%    352 KB  300 KB  -14%
fromList:randomDups:fusion     52 μs   48 μs   -7%    352 KB  300 KB  -14%
fromList:worstCase            711 μs  824 μs  +15%    6.9 MB   14 MB  +96%

IntMap:

Name                              Time - - - - - - - -    Allocated - - - - -
                                       A       B     %         A       B     %
fromList:asc                      100 μs   48 μs  -52%    864 KB  352 KB  -59%
fromList:asc:fusion                88 μs   37 μs  -57%    864 KB  352 KB  -59%
fromList:random                   480 μs  463 μs   -3%    1.5 MB  2.4 MB  +67%
fromList:random:fusion            452 μs  448 μs   +0%    1.5 MB  2.4 MB  +67%
fromList:randomDups               309 μs  263 μs  -15%    1.1 MB  1.7 MB  +57%
fromList:randomDups:fusion        296 μs  247 μs  -16%    1.1 MB  1.7 MB  +57%
fromList:worstCase                982 μs  1.1 ms  +16%    7.3 MB   14 MB  +97%
fromListWith:randomDups           316 μs  302 μs   -4%    1.3 MB  1.9 MB  +54%
fromListWith:randomDups:fusion    321 μs  335 μs   +4%    1.3 MB  2.3 MB  +86%

Implement a fusion-friendly version of the smarter algorithm proposed
in haskell#653.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant