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

Optimize cluster memory allocations #3098

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

nazar-pc
Copy link
Member

@nazar-pc nazar-pc commented Oct 6, 2024

Both CPU and GPU plotters produce a ~1G sector as a vector. For cluster purposes we need to send it over the network in chunks.

Previously vector was chunked into slices and then slices were allocated into separate smaller vectors. This is unnecessary though and with https://docs.rs/bytes/latest/bytes/struct.Bytes.html#method.slice_ref we can reuse the same large allocation (that will not be dropped until the whole sector is sent over anyway) for sub-slices. It would have been nice if there was a .chunks() method that produces Bytes instances directly, but we have what we have.

Just something I noticed while re-reading code.

Code contributor checklist:

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Looks good!

@nazar-pc nazar-pc added this pull request to the merge queue Oct 6, 2024
Merged via the queue into main with commit 1c5980d Oct 7, 2024
9 checks passed
@nazar-pc nazar-pc deleted the optimize-cluster-memory-allocations branch October 7, 2024 00:13
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.

2 participants