rokucommunity / brighterscript

A superset of Roku's BrightScript language
MIT License
151 stars 47 forks source link

Performance issues with `CompletionsProcessor` #1240

Open markwpearce opened 1 week ago

markwpearce commented 1 week ago

To get completions in v1, the CompletionsProcessor currently does a scope linking and symbol table lookup for EVERY scope, then checks to see if any resultant completions are valid for every scope.

For a file in many scopes, this can take a bit of time (sometimes greater than 500 ms).

There are probably ways to speed this up, perhaps by creating a temporary scope that is the intersection of all scopes for a file, then linking and doing symbol table lookups once for this temporary scope.

TwitchBronBron commented 4 days ago

In a recent PR to master (and the lsp rewrite branch), we switched to building completions from a subset of all scopes. Not sure why it hasn't made its way into v1, but we should ensure this functionality makes its way into v1.

https://github.com/rokucommunity/brighterscript/blob/963bcf0d5bbbf7aab355cbdea83d85e14e650d76/src/bscPlugin/completions/CompletionsProcessor.ts#L35-L50