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

Changed to a simpler sum. #604

Merged
merged 1 commit into from
Jul 7, 2022

Conversation

MadVikingGod
Copy link

This removes two allocations per unique metric, and improves run times considerably

$ benchstat bench-old bench-new
name old time/op new time/op delta
Int64Sum/count-10-4 7.81µs ±37% 3.29µs ± 5% -57.85% (p=0.000 n=10+10)
Int64Sum/count-50-4 36.1µs ±31% 15.6µs ± 7% -56.85% (p=0.000 n=10+10)
Int64Sum/count-100-4 64.7µs ± 5% 31.0µs ± 4% -52.17% (p=0.000 n=8+10)
Float64Sum/count-10-4 8.22µs ±31% 3.50µs ± 2% -57.45% (p=0.000 n=10+10)
Float64Sum/count-50-4 36.2µs ±29% 16.6µs ± 5% -54.13% (p=0.000 n=9+10)
Float64Sum/count-100-4 69.9µs ±15% 33.3µs ± 4% -52.37% (p=0.000 n=8+10)
Int64SumParallel-4 11.4ms ±19% 0.0ms ±51% -99.59% (p=0.000 n=9+10)
Float64SumParallel-4 12.3ms ±31% 0.1ms ±60% -99.57% (p=0.000 n=10+10)

name old alloc/op new alloc/op delta
Int64Sum/count-10-4 1.57kB ± 0% 0.50kB ± 0% -67.98% (p=0.000 n=10+10)
Int64Sum/count-50-4 6.88kB ± 0% 2.85kB ± 0% -58.63% (p=0.000 n=10+10)
Int64Sum/count-100-4 13.8kB ± 0% 5.2kB ± 0% -62.15% (p=0.000 n=10+9)
Float64Sum/count-10-4 1.65kB ± 0% 0.58kB ± 0% -64.68% (p=0.000 n=10+10)
Float64Sum/count-50-4 7.28kB ± 0% 3.25kB ± 0% -55.42% (p=0.000 n=10+10)
Float64Sum/count-100-4 14.6kB ± 0% 6.0kB ± 0% -58.75% (p=0.000 n=9+10)
Int64SumParallel-4 11.9kB ±17% 1.0kB ±20% -91.49% (p=0.000 n=10+10)
Float64SumParallel-4 12.0kB ±19% 1.2kB ±25% -89.91% (p=0.000 n=10+10)

name old allocs/op new allocs/op delta
Int64Sum/count-10-4 46.0 ± 0% 12.0 ± 0% -73.91% (p=0.000 n=10+10)
Int64Sum/count-50-4 208 ± 0% 52 ± 0% -75.00% (p=0.000 n=10+10)
Int64Sum/count-100-4 409 ± 0% 102 ± 0% -75.06% (p=0.000 n=10+10)
Float64Sum/count-10-4 56.0 ± 0% 22.0 ± 0% -60.71% (p=0.000 n=10+10)
Float64Sum/count-50-4 258 ± 0% 102 ± 0% -60.47% (p=0.000 n=10+10)
Float64Sum/count-100-4 509 ± 0% 202 ± 0% -60.31% (p=0.000 n=10+10)
Int64SumParallel-4 387 ±18% 20 ±21% -94.88% (p=0.000 n=10+10)
Float64SumParallel-4 406 ±19% 41 ±25% -89.92% (p=0.000 n=10+10)

@MadVikingGod MadVikingGod requested a review from MrAlias as a code owner June 27, 2022 21:27
@MrAlias MrAlias merged commit c7f9013 into MrAlias:impl-sum Jul 7, 2022
@MadVikingGod MadVikingGod deleted the mvg/new_sdk/impl-sum branch August 11, 2022 19:19
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