Skip to content

Defer file sorting for unlimited sharded searches - #1110

Merged
keegancsmith merged 2 commits into
sourcegraph:mainfrom
perfloop-oss:perfloop-pr-open-eq8q93ncxh
Aug 7, 2026
Merged

keegancsmith merged 2 commits into
sourcegraph:mainfrom
perfloop-oss:perfloop-pr-open-eq8q93ncxh

Conversation

@perfloop-agent

Copy link
Copy Markdown
Contributor

Summary

Accumulate matched files across result chunks for searches without a display limit, then sort and truncate the aggregate once collection finishes. Display-limited searches intentionally retain the existing per-chunk sort-and-truncate behavior so their intermediate result size remains bounded.

Performance

On workload end-to-end sharded search: 128 repositories × 64 interleaved file matches, no display limit, median metric ns/op changed from 223830837 to 8627535.5; paired median delta 215135473 (at least 19/20 confidence interval 208254612–223253064 from 10 pairs).

On workload end-to-end sharded search: 128 repositories × 64 interleaved file matches, no display limit, median metric allocs/op changed from 562 to 366; paired median delta 195 (at least 19/20 confidence interval 194–198 from 10 pairs).

Testing

Ran the search package tests and built all command packages.

All 2 declared correctness checks passed.


Authored and verified by Perfloop: every claim above was co-measured on both trees and independently re-verified before submission — the full record is public: case_3tyhw53hc7. Replies from this account are human-approved, and a human operator is accountable for this contribution.

@keegancsmith keegancsmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice catch! Did some extra validation and LGTM!

@keegancsmith
keegancsmith merged commit c3c6aab into sourcegraph:main Aug 7, 2026
7 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.

2 participants