Skip to content

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Sep 23, 2025

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

Copy link
Member Author

Sysix commented Sep 23, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@github-actions github-actions bot added A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance labels Sep 23, 2025
@Sysix Sysix marked this pull request as ready for review September 23, 2025 20:39
@Sysix Sysix requested a review from camc314 as a code owner September 23, 2025 20:39
Copilot AI review requested due to automatic review settings September 23, 2025 20:39
Copy link
Contributor

Copilot AI left a 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 consume OxcDiagnostic and 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-hq
Copy link

codspeed-hq bot commented Sep 23, 2025

CodSpeed Instrumentation Performance Report

Merging #14058 will not alter performance

Comparing 09-23-perf_language_server_avoid_cloning_on_message_conversation (c2f7459) with main (444fcf0)1

Summary

✅ 37 untouched

Footnotes

  1. No successful run was found on main (c2f7459) during the generation of this report, so 444fcf0 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Sysix Sysix changed the title perf(language_server): avoid cloning on message conversation perf(language_server): avoid cloning on message conversion Sep 23, 2025
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Sep 24, 2025
Copy link
Contributor

camc314 commented Sep 24, 2025

Merge activity

@camc314 camc314 self-assigned this Sep 24, 2025
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
```
@graphite-app graphite-app bot force-pushed the 09-23-perf_language_server_avoid_cloning_on_message_conversation branch from 8bc4b77 to c2f7459 Compare September 24, 2025 08:58
@graphite-app graphite-app bot merged commit c2f7459 into main Sep 24, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 09-23-perf_language_server_avoid_cloning_on_message_conversation branch September 24, 2025 09:03
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Sep 24, 2025
This was referenced Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants