Skip to content

improvement: improve perfomance of the presentation compiler#25769

Merged
zielinsky merged 5 commits intoscala:mainfrom
tgodzik:performance
Apr 21, 2026
Merged

improvement: improve perfomance of the presentation compiler#25769
zielinsky merged 5 commits intoscala:mainfrom
tgodzik:performance

Conversation

@tgodzik
Copy link
Copy Markdown
Contributor

@tgodzik tgodzik commented Apr 12, 2026

How much have you relied on LLM-based tools in this contribution?

Did some investigations using LLMs, but the code is mine.

How was the solution tested?

The tests are the same and I also run some benchmarks in the Metals codebase.

Additional notes

There are a few things that should improve performance:

  • we used to calculate scope completions twice, now we do it in the IndexedContext and later check accessiblity when needed
  • moved one name check into querying members instead of later
  • stopped calculating typed path multiple times, just once and construct everything from it.

Performance seems mostly around the same as with Scala 2 except on empty completion. Need to investigate that later.

@tgodzik tgodzik force-pushed the performance branch 2 times, most recently from c571cbf to 7d631e7 Compare April 12, 2026 18:00
@tgodzik tgodzik requested review from rochala and zielinsky April 13, 2026 08:38
Comment thread presentation-compiler/src/main/dotty/tools/pc/PcInlayHintsProvider.scala Outdated
Comment thread presentation-compiler/src/main/dotty/tools/pc/HoverProvider.scala Outdated
@tgodzik tgodzik force-pushed the performance branch 2 times, most recently from 982d045 to 4476fda Compare April 21, 2026 16:44
@tgodzik tgodzik requested a review from zielinsky April 21, 2026 16:46
tgodzik added 5 commits April 21, 2026 18:52
Previously, we would calculate the scope twice when completions were invoked. First for printing and to make sure we don't have conflicts and then to get the actual completions. Now, we use the first context from IndexedContext, but we check the actual accessibility, which was not checked in IndexedContext as it was useing Lazy Scope.
@zielinsky zielinsky merged commit 7154a4d into scala:main Apr 21, 2026
45 checks passed
mbovel pushed a commit to mbovel/dotty that referenced this pull request May 4, 2026
…5769)

## How much have you relied on LLM-based tools in this contribution?

Did some investigations using LLMs, but the code is mine.

## How was the solution tested?

The tests are the same and I also run some benchmarks in the Metals
codebase.

## Additional notes

There are a few things that should improve performance:
- we used to calculate scope completions twice, now we do it in the
IndexedContext and later check accessiblity when needed
- moved one name check into querying members instead of later
- stopped calculating typed path multiple times, just once and construct
everything from it.


Performance seems mostly around the same as with Scala 2 except on empty
completion. Need to investigate that later.
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