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: Shrink MemSliceInner enum #17991

Merged
merged 3 commits into from
Aug 1, 2024
Merged

perf: Shrink MemSliceInner enum #17991

merged 3 commits into from
Aug 1, 2024

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented Aug 1, 2024

Learned a few things after looking into the bytes::Bytes implementation. They essentially already do most of what we want from MemSliceInner, just without the Mmap support:

  • Creating a Bytes from a Vec is zero-copy
  • Creating an empty Bytes::new() doesn't heap-allocate
  • They have const fn Bytes::from_static we can use for the &'static [u8] case, which also doesn't allocate

This shrinks the size of MemSliceInner from 40 to 32 bytes

@github-actions github-actions bot added performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars labels Aug 1, 2024
@nameexhaustion nameexhaustion marked this pull request as ready for review August 1, 2024 10:25
@ritchie46 ritchie46 merged commit a10f9b7 into pola-rs:main Aug 1, 2024
22 checks passed
@nameexhaustion nameexhaustion deleted the mem branch August 4, 2024 10:31
@c-peters c-peters added the accepted Ready for implementation label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation performance Performance issues or improvements python Related to Python Polars rust Related to Rust Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants