Skip to content

Conversation

@caicancai
Copy link
Contributor

@caicancai caicancai commented Feb 8, 2026

This PR speeds up State::next_coalesced() by avoiding an O(k) linear scan for every candidate when checking whether a request was already marked for removal. Previously, scanning a window of n candidates with k already-marked ids could cost O(n·k) (worst-case O(n²)). We keep the Vec<(offset, id)> for removals, but add a HashSet for O(1) average membership checks, bringing the scan closer to O(n). Coalescing behavior is unchanged.

@caicancai caicancai force-pushed the perf/io-coalesce-hashset branch from 5deafb8 to 3fe1afe Compare February 8, 2026 04:41
@joseph-isaacs joseph-isaacs added the action/benchmark Trigger full benchmarks to run on this PR label Feb 9, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 9, 2026

Merging this PR will not alter performance

✅ 1138 untouched benchmarks
⏩ 1265 skipped benchmarks1


Comparing caicancai:perf/io-coalesce-hashset (91257b9) with develop (cfd9116)

Open in CodSpeed

Footnotes

  1. 1265 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@caicancai caicancai force-pushed the perf/io-coalesce-hashset branch from 3fe1afe to e27b173 Compare February 9, 2026 13:03
@caicancai caicancai force-pushed the perf/io-coalesce-hashset branch from e27b173 to 91257b9 Compare February 9, 2026 13:06
@caicancai
Copy link
Contributor Author

@joseph-isaacs Sorry, the issue of cargo clippy failing has been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action/benchmark Trigger full benchmarks to run on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants