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

Reimplement Map.All without using Map.Iter #3

Merged
merged 1 commit into from
Sep 18, 2024
Merged

Reimplement Map.All without using Map.Iter #3

merged 1 commit into from
Sep 18, 2024

Conversation

aaronbee
Copy link
Member

Implement the native iterate code inside All. All should be the preferred way to iterate over Map when using go1.23. This reimplementation reduces its overhead.

goos: darwin
goarch: amd64
pkg: github.com/aristanetworks/gomap
cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
       │  before.txt  │              after.txt              │
       │    sec/op    │   sec/op     vs base                │
All-16   157.60n ± 2%   56.70n ± 1%  -64.02% (p=0.000 n=10)

       │ before.txt │             after.txt              │
       │    B/op    │   B/op     vs base                 │
All-16   96.00 ± 0%   0.00 ± 0%  -100.00% (p=0.000 n=10)

       │ before.txt │              after.txt              │
       │ allocs/op  │ allocs/op   vs base                 │
All-16   1.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)

Implement the native iterate code inside All. All should be the
preferred way to iterate over Map when using go1.23. This
reimplementation reduces its overhead.

goos: darwin
goarch: amd64
pkg: github.com/aristanetworks/gomap
cpu: Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
       │  before.txt  │              after.txt              │
       │    sec/op    │   sec/op     vs base                │
All-16   157.60n ± 2%   56.70n ± 1%  -64.02% (p=0.000 n=10)

       │ before.txt │             after.txt              │
       │    B/op    │   B/op     vs base                 │
All-16   96.00 ± 0%   0.00 ± 0%  -100.00% (p=0.000 n=10)

       │ before.txt │              after.txt              │
       │ allocs/op  │ allocs/op   vs base                 │
All-16   1.000 ± 0%   0.000 ± 0%  -100.00% (p=0.000 n=10)
@aaronbee aaronbee merged commit d348323 into main Sep 18, 2024
2 checks passed
@aaronbee aaronbee deleted the new_all branch September 18, 2024 22:56
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