-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
compiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgenEverything to do with type checking, control flow analysis, and everything between parsing and IRgenepicAn epic is a high-level master issue for large pieces of work.An epic is a high-level master issue for large pieces of work.language serverLSP serverLSP serverteam:compilerCompiler TeamCompiler Team
Description
Here is a list of optimisations that can be made to improve the responsiveness of the language server in response to did change events. Times are measured against the benchmark
example in sway-lsp
tests.
- Wrap the
programs_cache
from the QE around an Arc23.015ms
| Reduce cloning in the programs cache for LSP #5550 - Disable running DCA, control flow analysis?, for didChange events
39.544ms
Disable DCA and writing diagnostics on did_change events #5555 - Disable
running collect_types_metadata
for didChange events3.522ms
Disable DCA and writing diagnostics on did_change events #5555 - Only write the diagnostics res to
self.diagnostics.write()
on didSave21.135ms
Disable DCA and writing diagnostics on did_change events #5555 - Don’t write TokenMap or Metrics into an intermediate copy and then write back to the original in
write_parse_result
| see if we can write to them directly.36.635ms
LSP Optimization: RemoveParseResult
and write to session types directly #5516 - Cache
document::mark_file_as_dirty
at the beginning of didChange708.625µs
cache pid lock files to reduce IO operations #6297 - Optimise
uri_and_session_from_workspace
function by caching results575.667µs
Optimize manifest directory lookup with efficient caching #6444 - Write changes to memory instead of disk in
write_changes_to_file
func3.387ms
- Cache the
BuildPlan
instead of creating on before compilation2.425ms
CacheBuildPlan
in LSP #5462 - We clear the whole
TokenMap
and traverse and repopulate the modules alongside the users workspace. We should only need to do this once. Optimise clearing and traversing code to only re-parse the modified file #62928.674ms
- Possibly run
parse_ast_to_typed_tokens
using a rayon par iter? (139.6ms
→127.7ms
) | LSP Optimization: Use rayon forparse_ast_to_typed_tokens
function #5473 - Use rayon par_iters in the
traverse::typed_tree
module. We are doing this intraverse::parsed_tree
which takes11.3ms
while typed traverse takes140ms
| LSP Optimization: Add par_iters to thetraverse::typed_tree
module #5487
tritao
Metadata
Metadata
Assignees
Labels
compiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgenEverything to do with type checking, control flow analysis, and everything between parsing and IRgenepicAn epic is a high-level master issue for large pieces of work.An epic is a high-level master issue for large pieces of work.language serverLSP serverLSP serverteam:compilerCompiler TeamCompiler Team