Skip to content

Tweak MmapFile, so that mmap access is a teeny-tiny bit more efficient - #8511

Merged
ffuugoo merged 1 commit into
devfrom
universal-mmap-micro-optimization
Mar 26, 2026
Merged

ffuugoo merged 1 commit into
devfrom
universal-mmap-micro-optimization

Conversation

@ffuugoo

@ffuugoo ffuugoo commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

MmapFile contains Arc<MmapRaw>, so we save a few cycles by only dereferencing Arc once.

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --workspace --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@ffuugoo
ffuugoo requested a review from generall March 26, 2026 09:10
@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@ffuugoo

ffuugoo commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor Author

Also, btw, I did benchmark this. It got faster. From 5us (for read_batch of 1000 ranges of 100 f32 each) to 3us. No access to data, just measuring overhead of pointer deref and cast_slice. With access (sum all elements of each range) there's no noticeable difference. Wild gains.

@ffuugoo
ffuugoo merged commit 69b70ee into dev Mar 26, 2026
15 checks passed
@ffuugoo
ffuugoo deleted the universal-mmap-micro-optimization branch March 26, 2026 11:19
@generall generall added this to the Universal IO milestone Mar 26, 2026
generall pushed a commit that referenced this pull request Mar 26, 2026
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
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