fix: scale issues — clustering 450x faster, long-message entity retention 2x#22
Merged
fix: scale issues — clustering 450x faster, long-message entity retention 2x#22
Conversation
- Semantic clustering: pre-compute pairwise similarity matrix instead of recomputing per merge iteration. Cap at 200 candidates (most recent). 450x faster at 500 messages (38s → 83ms) - Long message budget: scale cap logarithmically for content >5k chars. At 10k: 920 chars (was 600). At 50k: ~1300. At 100k: ~1500. Doubles entity retention at 10k chars (55% → 91%) - Entity suffix: scale max entities to 30 for long messages (was 15) - Budget strategy docs: note that tiered is 7-8x faster than binary-search at 500+ messages, recommend for large conversations - Add bench/scale-test.ts: 51-test scale analysis covering message count scaling, long messages, composition, recency window impact, budget strategies, v2 features at scale, pathological patterns, and multi-round compression convergence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes three issues found by the new scale test (
bench/scale-test.ts, 51 tests):1. Semantic clustering O(n²) blowup — 450x faster
2. Long-message entity retention — 2x improvement at 10k chars
3. Binary search vs tiered documentation
Remaining known limits (by design, not bugs)
Test plan