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

raft: Avoid allocation when boxing slice in maybeCommit #10679

Merged
merged 1 commit into from Apr 30, 2019

Conversation

4 participants
@nvanbenschoten
Copy link
Contributor

commented Apr 26, 2019

By boxing a heap-allocated slice header instead of the slice
header on the stack, we can avoid an allocation when passing
through the sort.Interface interface.

This was responsible for 26.61% of total allocations in an
experiment with https://github.com/nvanbenschoten/raft-toy.

Please read https://github.com/etcd-io/etcd/blob/master/CONTRIBUTING.md#contribution-flow.

raft: Avoid allocation when boxing slice in maybeCommit
By boxing a heap-allocated slice header instead of the slice
header on the stack, we can avoid an allocation when passing
through the sort.Interface interface.

This was responsible for 26.61% of total allocations in an
experiment with https://github.com/nvanbenschoten/raft-toy.
@nvanbenschoten

This comment has been minimized.

Copy link
Contributor Author

commented Apr 26, 2019

cc. @bdarnell

@codecov-io

This comment has been minimized.

Copy link

commented Apr 26, 2019

Codecov Report

Merging #10679 into master will decrease coverage by 0.13%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10679      +/-   ##
==========================================
- Coverage   71.63%   71.49%   -0.14%     
==========================================
  Files         394      394              
  Lines       36658    36658              
==========================================
- Hits        26261    26210      -51     
- Misses       8564     8613      +49     
- Partials     1833     1835       +2
Impacted Files Coverage Δ
raft/raft.go 92.19% <100%> (ø) ⬆️
etcdctl/ctlv2/command/watch_command.go 57.5% <0%> (-22.5%) ⬇️
client/members.go 66.12% <0%> (-19.36%) ⬇️
pkg/logutil/zap_grpc.go 47.61% <0%> (-4.77%) ⬇️
proxy/grpcproxy/watch.go 88.55% <0%> (-4.22%) ⬇️
etcdserver/v2_server.go 80.76% <0%> (-3.85%) ⬇️
etcdserver/util.go 95% <0%> (-3.75%) ⬇️
pkg/testutil/recorder.go 77.77% <0%> (-3.71%) ⬇️
clientv3/balancer/balancer.go 84.25% <0%> (-2.37%) ⬇️
etcdserver/api/v3rpc/lease.go 69.31% <0%> (-2.28%) ⬇️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cca0d5c...208b8a3. Read the comment docs.

@xiang90 xiang90 merged commit 0bc219a into etcd-io:master Apr 30, 2019

2 checks passed

Travis CI - Pull Request Build Passed
Details
semaphoreci The build passed on Semaphore.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.