Skip to content

Coalesce contiguous ranges in LocalFileSystem::get_ranges#777

Merged
Dandandan merged 1 commit into
apache:mainfrom
Dandandan:local-coalesce-get-ranges
Jun 30, 2026
Merged

Coalesce contiguous ranges in LocalFileSystem::get_ranges#777
Dandandan merged 1 commit into
apache:mainfrom
Dandandan:local-coalesce-get-ranges

Conversation

@Dandandan

@Dandandan Dandandan commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Closes: #778

LocalFileSystem::get_ranges issued one read per range. This coalesces contiguous/overlapping ranges into a single read, collapsing many adjacent ranges into far fewer syscalls.

  • Uses a coalesce gap of 0 (vs the 1 MiB network default), so we never read bytes that weren't requested.

On a warm-cache benchmark, many adjacent small ranges drop ~2.6× (e.g. 1024 × 4 KiB contiguous: ~700 µs → ~260 µs); disjoint ranges are unchanged.

🤖 Generated with Claude Code

Merge only contiguous/overlapping ranges (gap 0) into a single read, so we
never read unrequested bytes but still collapse many adjacent ranges into
far fewer syscalls. A fast path skips the coalescing bookkeeping entirely
when nothing merges, avoiding overhead for disjoint ranges.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@kevinjqliu kevinjqliu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Comment thread src/local.rs
@Dandandan Dandandan merged commit f04df7a into apache:main Jun 30, 2026
9 checks passed
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.

Coalesce contiguous ranges in LocalFileSystem::get_ranges

2 participants