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

fastdelta: remove sort allocations #1512

Conversation

felixge
Copy link
Member

@felixge felixge commented Oct 12, 2022

While looking at the internal testing that's going on, I noticed a lot of allocations caused by a sort.Slice().

image

I think we can easily get rid of them by applying this PR. The benchmarks says this will reduce allocated objects by ~60% and CPU time by 10%.

Let me know what you think.

name                                  old time/op    new time/op    delta
FastDelta/testdata/heap.pprof-12         924µs ± 2%     827µs ± 3%  -10.53%  (p=0.008 n=5+5)
FastDelta/testdata/big-heap.pprof-12    12.2ms ± 4%    10.9ms ± 4%  -10.29%  (p=0.008 n=5+5)

name                                  old alloc/op   new alloc/op   delta
FastDelta/testdata/heap.pprof-12         289kB ± 0%     226kB ± 0%  -22.00%  (p=0.008 n=5+5)
FastDelta/testdata/big-heap.pprof-12    2.44MB ± 0%    1.71MB ± 0%  -29.77%  (p=0.008 n=5+5)

name                                  old allocs/op  new allocs/op  delta
FastDelta/testdata/heap.pprof-12         3.33k ± 0%     1.34k ± 0%  -59.66%  (p=0.008 n=5+5)
FastDelta/testdata/big-heap.pprof-12     37.2k ± 0%     14.5k ± 0%  -61.10%  (p=0.008 n=5+5)

name                                  old time/op    new time/op    delta
FastDelta/testdata/heap.pprof-12         924µs ± 2%     827µs ± 3%  -10.53%  (p=0.008 n=5+5)
FastDelta/testdata/big-heap.pprof-12    12.2ms ± 4%    10.9ms ± 4%  -10.29%  (p=0.008 n=5+5)

name                                  old alloc/op   new alloc/op   delta
FastDelta/testdata/heap.pprof-12         289kB ± 0%     226kB ± 0%  -22.00%  (p=0.008 n=5+5)
FastDelta/testdata/big-heap.pprof-12    2.44MB ± 0%    1.71MB ± 0%  -29.77%  (p=0.008 n=5+5)

name                                  old allocs/op  new allocs/op  delta
FastDelta/testdata/heap.pprof-12         3.33k ± 0%     1.34k ± 0%  -59.66%  (p=0.008 n=5+5)
FastDelta/testdata/big-heap.pprof-12     37.2k ± 0%     14.5k ± 0%  -61.10%  (p=0.008 n=5+5)
@felixge felixge requested a review from a team as a code owner October 12, 2022 07:51
Copy link
Contributor

@nsrip-dd nsrip-dd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of the same change :) Thanks!

@felixge felixge merged commit 5d31bb8 into feature-fast-delta-profiling Oct 12, 2022
@felixge felixge deleted the felix.geisendoerfer/fastdelta-sort-allocs branch October 12, 2022 11:10
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.

None yet

2 participants