sway
sway copied to clipboard
Further optimisations for compilation events triggered by the language server.
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.
- [x] Wrap the
programs_cachefrom the QE around an Arc23.015ms| #5550 - [x] Disable running DCA, control flow analysis?, for didChange events
39.544ms#5555 - [x] Disable
running collect_types_metadatafor didChange events3.522ms#5555 - [x] Only write the diagnostics res to
self.diagnostics.write()on didSave21.135ms#5555 - [x] 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#5516 - [x] Cache
document::mark_file_as_dirtyat the beginning of didChange708.625µs#6297 - [x] Optimise
uri_and_session_from_workspacefunction by caching results575.667µs#6444 - [ ] Write changes to memory instead of disk in
write_changes_to_filefunc3.387ms - [x] Cache the
BuildPlaninstead of creating on before compilation2.425ms#5462 - [x] We clear the whole
TokenMapand traverse and repopulate the modules alongside the users workspace. We should only need to do this once. #62928.674ms - [x] Possibly run
parse_ast_to_typed_tokensusing a rayon par iter? (139.6ms→127.7ms) | #5473 - [x] Use rayon par_iters in the
traverse::typed_treemodule. We are doing this intraverse::parsed_treewhich takes11.3mswhile typed traverse takes140ms| #5487