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

perf(storagenode): wrap replicateTask slice with struct #416

Merged
merged 1 commit into from
Apr 15, 2023

Conversation

ijsong
Copy link
Member

@ijsong ijsong commented Apr 13, 2023

What this PR does

The replicateTaskSlicePool pooled slices of replicateTask. The function
releaseReplicateTaskSlice received borrowed slice and then put it into replicateTaskSlicePool.
However, the sync.(Pool).Put parameter is an interface, so the slice escaped to the heap
unnecessarily.

Not to use unnecessary heap objects, this PR wraps the replicateTask slice with the struct
replicateTaskSlice.

Which issue(s) this PR resolves

Resolves #75

@ijsong ijsong requested a review from hungryjang as a code owner April 13, 2023 10:04
@ijsong
Copy link
Member Author

ijsong commented Apr 13, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@ijsong ijsong self-assigned this Apr 13, 2023
@codecov-commenter
Copy link

codecov-commenter commented Apr 13, 2023

Codecov Report

Patch coverage: 88.23% and project coverage change: -0.02 ⚠️

Comparison is base (d57be48) 63.56% compared to head (7add8f4) 63.55%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #416      +/-   ##
==========================================
- Coverage   63.56%   63.55%   -0.02%     
==========================================
  Files         131      131              
  Lines       17809    17811       +2     
==========================================
- Hits        11321    11319       -2     
- Misses       5944     5945       +1     
- Partials      544      547       +3     
Impacted Files Coverage Δ
internal/storagenode/logstream/append.go 80.00% <0.00%> (ø)
internal/storagenode/logstream/replicate_task.go 100.00% <100.00%> (ø)
internal/storagenode/logstream/sequencer.go 92.48% <100.00%> (ø)

... and 7 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

The `replicateTaskSlicePool` pooled slices of `replicateTask`. The function
`releaseReplicateTaskSlice` received borrowed slice and then put it into `replicateTaskSlicePool`.
However, the `sync.(Pool).Put` parameter is an interface, so the slice escaped to the heap
unnecessarily.

Not to use unnecessary heap objects, this PR wraps the `replicateTask` slice with the struct
replicateTaskSlice.

Resolves #75
@ijsong ijsong merged commit 911b5fe into main Apr 15, 2023
@ijsong ijsong deleted the replicate_task_slice branch April 15, 2023 12:50
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.

Replicate tasks slice pool causes heap allocation
3 participants