295354b538
Normalization was previously done by calling `replaceAll()` on the payload for each replacement string, but there can be a lot of these (207 when I open a workspace in the SDK, even if they're not all in the workspace). With this change, we build a single regex that does all replacements in a single pass, caching the regex between calls. It also handles some additional variations of each path (path, file URI, escaped colons in Windows drive letters, etc). I've included a (skipped) test that prints the time taken for a 2MB payload with 250 paths to replace to make it easier to tweak if necessary in future. There might be more improvements we could make (for example not needing to add some many paths), but this is an easy win to speed things up. Before: ``` Normalizer took 987ms to replace 250 paths in payload of 2097162 bytes. Normalizer took 969ms to replace 250 paths in payload of 2097162 bytes. Normalizer took 978ms to replace 250 paths in payload of 2097162 bytes. Normalizer took 966ms to replace 250 paths in payload of 2097162 bytes. Normalizer took 965ms to replace 250 paths in payload of 2097162 bytes. ``` After: ``` Normalizer took 33ms to replace 250 paths in payload of 2097166 bytes. Normalizer took 25ms to replace 250 paths in payload of 2097166 bytes. Normalizer took 25ms to replace 250 paths in payload of 2097166 bytes. Normalizer took 27ms to replace 250 paths in payload of 2097166 bytes. Normalizer took 28ms to replace 250 paths in payload of 2097166 bytes. ``` Fixes https://github.com/dart-lang/sdk/issues/62956 Change-Id: I4e8008c77087eb6bd133c86e6bfa2b8843ded197 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/490640 Commit-Queue: Samuel Rawlins <srawlins@google.com> Reviewed-by: Samuel Rawlins <srawlins@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
analysis_server
A long-running process that provides analysis results to other tools.
The analysis server is designed to provide on-going analysis of one or more code bases as those code bases are changing.
Using the server
The analysis server is not intended to be used stand-alone, and therefore does not have a human-friendly user interface.
Clients (typically tools, such as an editor) are expected to run the analysis
server in a separate process and communicate with it using a JSON protocol. The
original protocol is specified in the file analysis_server/doc/api.html
and Language Server Protocol support is documented in
tool/lsp_spec/README.md.
Features and bugs
Please file feature requests and bugs at the issue tracker.