Skip to content

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

Merged
ijsong merged 1 commit intomainfrom
replicate_task_slice
Apr 15, 2023
Merged

perf(storagenode): wrap replicateTask slice with struct#416
ijsong merged 1 commit intomainfrom
replicate_task_slice

Conversation

@ijsong
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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.

@ijsong ijsong force-pushed the replicate_task_slice branch from bf5fb22 to 7add8f4 Compare April 13, 2023 13:44
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 force-pushed the replicate_task_slice branch from 7add8f4 to 37250e1 Compare April 15, 2023 12:36
@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