-
-
Notifications
You must be signed in to change notification settings - Fork 716
perf(language_server): avoid cloning on message conversion #14058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf(language_server): avoid cloning on message conversion #14058
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR optimizes memory allocation in the language server by removing unnecessary references and clones when converting messages. The performance improvement reduces allocations from 172,985 to 170,985 in benchmark testing.
- Removes reference taking (
&) in function calls to avoid unnecessary clones - Adds
inner_owned()method to consumeOxcDiagnosticand return owned inner data - Refactors message conversion functions to reuse logic and eliminate code duplication
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_linter/src/tsgolint.rs | Removes reference taking when converting tsgo lint diagnostic to message |
| crates/oxc_linter/src/service/runtime.rs | Removes references in diagnostic and message conversion calls |
| crates/oxc_linter/src/lsp.rs | Refactors message conversion to avoid cloning and reuse existing logic |
| crates/oxc_diagnostics/src/lib.rs | Adds inner_owned() method to consume diagnostic and return owned data |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
CodSpeed Instrumentation Performance ReportMerging #14058 will not alter performanceComparing Summary
Footnotes |
Merge activity
|
Tested it with one `no-debugger` rule on a file (100 times).
Main:
```
heaptrack stats:
allocations: 172985
leaked allocations: 580
temporary allocations: 53112
```
This PR:
```
heaptrack stats:
allocations: 170985
leaked allocations: 580
temporary allocations: 53111
```
8bc4b77 to
c2f7459
Compare

Tested it with one
no-debuggerrule on a file (100 times).Main:
This PR: