Skip to content
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

We should check on the inlining properties of hashNubOn and ordNubOn. #78

Open
phadej opened this issue Jan 15, 2021 · 0 comments
Open
Assignees

Comments

@phadej
Copy link
Collaborator

phadej commented Jan 15, 2021

See comment #77 (comment)

On the flip side, if witherM can fuse with a "good producer" of some sort, will that be a problem? Let's investigate.

Benchmark                 bench-lazy  bench-eta          bench-noinline          
fewstring/list/hashNub       1.65e-4    1.69e-4  +2.52%         2.46e-4   +49.12%
fewstring/list/hashOpt       1.59e-4    1.63e-4  +1.94%         1.59e-4    -0.58%
fewstring/list/ordNub        3.99e-4    3.90e-4  -2.10%         5.39e-4   +35.22%
fewstring/vector/hashNub     1.72e-4    1.75e-4  +1.56%         2.35e-4   +36.29%
fewstring/vector/ordNub      4.01e-4    3.96e-4  -1.37%         5.33e-4   +32.81%
string/list/hashNub          9.50e-2    9.60e-2  +1.10%         9.76e-2    +2.75%
string/list/hashOpt          9.81e-2       0.10  +2.12%         9.81e-2    -0.01%
string/list/ordNub              0.10       0.10  +1.16%            0.13   +30.47%
string/vector/hashNub        7.96e-2    8.09e-2  +1.59%         8.51e-2    +6.82%
string/vector/ordNub            0.11       0.11  +2.23%            0.14   +31.09%
text/list/hashNub            9.18e-2    9.04e-2  -1.57%         8.83e-2    -3.88%
text/list/hashOpt            9.04e-2    9.18e-2  +1.55%         9.08e-2    +0.40%
text/list/ordNub             7.82e-2    7.40e-2  -5.48%            0.13   +66.99%
text/vector/hashNub          9.60e-2    9.36e-2  -2.48%         8.41e-2   -12.40%
text/vector/ordNub           7.98e-2    7.78e-2  -2.55%            0.13   +63.05%
word64s/list/hashNub         6.06e-2    6.26e-2  +3.35%         6.67e-2   +10.21%
word64s/list/hashOpt         5.97e-2    6.09e-2  +2.06%         6.22e-2    +4.18%
word64s/list/ordNub          5.63e-2    5.69e-2  +1.15%            0.11  +101.46%
word64s/vector/hashNub       6.35e-2    6.40e-2  +0.71%         6.82e-2    +7.33%
word64s/vector/ordNub        5.79e-2    5.74e-2  -0.79%            0.11   +90.75%
zzz-geom-mean                1.85e-2    1.85e-2  +0.31%         2.29e-2   +24.03%

Where

bench-lazy is #77
bench-eta is with

-ordNubOn p t = evalState (witherM f t) Set.empty where
+ordNubOn p = \t -> evalState (witherM f t) Set.empty where

-hashNubOn p t = evalState (witherM f t) HSet.empty
+hashNubOn p = \t -> evalState (witherM f t) HSet.empty

and bench-noinline

is additionally dropping INLINE pragmas.

hashOpt is hashNub written manually for lists (without using witherM).


I can add this benchmark suite to the repository if it's fine (it will make CI slower as installing criterion takes some time when cache is cold).


(The table is made with criterion-compare-txt from aeson repository).

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

No branches or pull requests

2 participants