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

More efficient Eq, Ord for Seq #1035

Merged
merged 1 commit into from
Sep 11, 2024
Merged

Conversation

meooow25
Copy link
Contributor

@meooow25 meooow25 commented Sep 8, 2024

For #1016.

Benchmarks on GHC 9.6.3:

Before
All
  eq
    100/100:     OK
      1.43 μs ±  86 ns, 7.5 KB allocated,   1 B  copied,  10 MB peak memory
    10000/10000: OK
      152  μs ±  13 μs, 748 KB allocated, 237 B  copied,  10 MB peak memory
  compare
    100/100:     OK
      1.59 μs ±  88 ns, 7.5 KB allocated,   1 B  copied,  10 MB peak memory
    10000/10000: OK
      170  μs ±  14 μs, 748 KB allocated, 234 B  copied,  10 MB peak memory
    100/10000:   OK
      1.62 μs ± 158 ns, 7.8 KB allocated,   1 B  copied,  10 MB peak memory
    10000/100:   OK
      1.70 μs ± 166 ns, 7.7 KB allocated,   1 B  copied,  10 MB peak memory

After

All
  eq
    100/100:     OK
      843  ns ±  43 ns, 7.1 KB allocated,   0 B  copied,  10 MB peak memory, 40% less than baseline
    10000/10000: OK
      92.1 μs ± 5.4 μs, 719 KB allocated, 217 B  copied,  10 MB peak memory, 39% less than baseline
  compare
    100/100:     OK
      955  ns ±  90 ns, 7.1 KB allocated,   0 B  copied,  10 MB peak memory, 39% less than baseline
    10000/10000: OK
      98.0 μs ± 5.8 μs, 719 KB allocated, 216 B  copied,  10 MB peak memory, 42% less than baseline
    100/10000:   OK
      931  ns ±  55 ns, 7.4 KB allocated,   1 B  copied,  10 MB peak memory, 42% less than baseline
    10000/100:   OK
      941  ns ±  88 ns, 7.4 KB allocated,   1 B  copied,  10 MB peak memory, 44% less than baseline

@meooow25 meooow25 requested a review from treeowl September 10, 2024 13:47
* Add benchmarks
* Keep the list based implementation, for now, but define the list
  comparisons ourself to avoid base's performance issues.
  On Seq Int and with GHC 9.6.3, benchmark times improve by ~40%.
@meooow25 meooow25 merged commit 028e187 into haskell:master Sep 11, 2024
11 checks passed
@meooow25 meooow25 deleted the seq-eq-ord branch September 11, 2024 14:44
@meooow25 meooow25 mentioned this pull request Sep 11, 2024
8 tasks
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.

2 participants