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

Preallocate buffers to object uploads #835

Merged
merged 2 commits into from
Oct 9, 2023
Merged

Conversation

smallhive
Copy link
Contributor

closes #833

@codecov
Copy link

codecov bot commented Oct 4, 2023

Codecov Report

Merging #835 (1ba680c) into master (6211075) will decrease coverage by 0.19%.
Report is 16 commits behind head on master.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master     #835      +/-   ##
==========================================
- Coverage   34.05%   33.86%   -0.19%     
==========================================
  Files          61       62       +1     
  Lines       10472    10529      +57     
==========================================
  Hits         3566     3566              
- Misses       6505     6562      +57     
  Partials      401      401              
Files Coverage Δ
internal/neofs/epoch.go 0.00% <0.00%> (ø)
internal/neofs/neofs.go 1.32% <0.00%> (-0.11%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@smallhive smallhive force-pushed the 833-optimize-allocations branch 3 times, most recently from 27163a8 to ec47db0 Compare October 4, 2023 10:38
@smallhive smallhive marked this pull request as ready for review October 5, 2023 09:38
Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

Can slicer reuse buffers as well?

Pool-based code is simpler in general.

internal/neofs/neofs.go Outdated Show resolved Hide resolved
internal/neofs/neofs.go Outdated Show resolved Hide resolved
internal/neofs/neofs.go Outdated Show resolved Hide resolved
@smallhive smallhive force-pushed the 833-optimize-allocations branch 2 times, most recently from 5641ff7 to 86aa06f Compare October 6, 2023 11:05
@smallhive smallhive force-pushed the 833-optimize-allocations branch 3 times, most recently from 4253ce3 to f0f5a22 Compare October 9, 2023 11:09
@smallhive
Copy link
Contributor Author

Can slicer reuse buffers as well?

Pool-based code is simpler in general.

Supported

The test requires real neofs cluster to execute. We are checking the object after uploading.

Signed-off-by: Evgenii Baidakov <[email protected]>
chunk := make([]byte, x.cfg.MaxObjectSize)
_, err = io.CopyBuffer(writer, prm.Payload, chunk)
data := x.buffers.Get()
chunk := data.(*[]byte)
Copy link
Member

Choose a reason for hiding this comment

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

Likely some Go 1.2X will bring generic-based Pool to us.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be great, but 1.21 still have any version

@roman-khimov roman-khimov merged commit b457e6b into master Oct 9, 2023
14 of 16 checks passed
@roman-khimov roman-khimov deleted the 833-optimize-allocations branch October 9, 2023 12:12
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.

Optimize allocations
2 participants