Skip to content

Improve completion responsiveness - #743

Merged
renkun-ken merged 3 commits into
masterfrom
improve-completion
Jul 15, 2026
Merged

renkun-ken merged 3 commits into
masterfrom
improve-completion

Conversation

@renkun-ken

@renkun-ken renkun-ken commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

Summary

  • pre-index document completion candidates during background parsing and cache reusable workspace data
  • bound workspace, scope, and token providers before constructing LSP completion items
  • add native parse-tree indexing and bounded top-N selection for completion hot paths
  • use deterministic UTF-8 radix ordering for truncated completion lists

Performance compared with master

The benchmark compares clean source archives of untouched master at a3c8133 and this PR at 19539bc.

Completion path master median PR median Speedup Time reduction
Full completion request 5,357.40 ms 18.00 ms 297.6x 99.66%
Scope provider 5,178.08 ms 6.46 ms 801.7x 99.88%
Token provider 134.94 ms 1.28 ms 105.3x 99.05%
Workspace provider 23.78 ms 3.95 ms 6.0x 83.38%

The full request returns the same configured maximum of 200 completion items on both revisions. Measured R allocations for that request fall from 5.66 MB to 4.24 MB, a 25.1% reduction.

Benchmark methodology

  • R 4.5.1 on arm64 macOS
  • 10,000 matching in-scope symbols and 10,000 matching workspace symbols
  • token value_, snippets disabled, and max_completions = 200
  • three warm-up runs followed by 10 measured iterations per path; table reports bench::mark() medians
  • parsing and fixture setup excluded to measure completion-request latency after background parse data is available
  • provider result counts are intentionally different: master constructs all 10,000 candidates before final truncation, while the PR bounds each broad provider at 200; the end-to-end request returns 200 on both

Testing

  • completion test suite: 175 passed, 0 failed
  • utility test suite passed
  • native compilation succeeded
  • git diff --check passed

@renkun-ken
renkun-ken merged commit 93cba5c into master Jul 15, 2026
5 checks passed
This was referenced Sep 11, 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.

1 participant