Skip to content

perf(biome_package): improve performance of biome_package#6732

Merged
arendjr merged 17 commits intobiomejs:mainfrom
vladimir-ivanov:fix/useReadonlyClassProperties-check-get-for-mutation
Jul 7, 2025
Merged

perf(biome_package): improve performance of biome_package#6732
arendjr merged 17 commits intobiomejs:mainfrom
vladimir-ivanov:fix/useReadonlyClassProperties-check-get-for-mutation

Conversation

@vladimir-ivanov
Copy link
Copy Markdown
Contributor

@vladimir-ivanov vladimir-ivanov commented Jul 6, 2025

Summary

Improved performance of the biome_package parser by filtering out unnecessary JSON entries in package.json.
closes [#6281]
Screenshot 2025-07-06 at 19 52 51

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jul 6, 2025

🦋 Changeset detected

Latest commit: 3b8b116

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Resolver Area: resolver labels Jul 6, 2025
…y membeers arrow function body too for mutation
…y membeers arrow function body too for mutation
…y membeers arrow function body too for mutation
…file by only parsing allowed list of properties instead of all entries
@vladimir-ivanov vladimir-ivanov force-pushed the fix/useReadonlyClassProperties-check-get-for-mutation branch from 3efefe8 to 53cb32d Compare July 6, 2025 18:52
@github-actions github-actions Bot removed the A-Linter Area: linter label Jul 6, 2025
@vladimir-ivanov vladimir-ivanov changed the title Fix/use readonly class properties check get for mutation perf(biome_package): use readonly class properties check get for mutation Jul 6, 2025
@ematipico ematipico requested review from a team and removed request for arendjr and ematipico July 6, 2025 19:45
@ematipico
Copy link
Copy Markdown
Member

It seems that CodSpeed doesn't trigger because the paths are outdated

paths:
- 'Cargo.lock'
- 'crates/**_parser/**/*.rs'
- 'crates/**_formatter/**/*.rs'
- 'crates/**_analyze/**/*.rs'
- 'crates/biome_grit_patterns/**/*.rs'
push:
branches:
- main
paths:
- 'Cargo.lock'
- 'crates/**_parser/**/*.rs'
- 'crates/**_formatter/**/*.rs'
- 'crates/**_analyze/**/*.rs'
- 'crates/biome_grit_patterns/**/*.rs'

We should update them, and trigger it also for biome_package and biome_configuration

@vladimir-ivanov
Copy link
Copy Markdown
Contributor Author

vladimir-ivanov commented Jul 6, 2025

It seems that CodSpeed doesn't trigger because the paths are outdated

paths:
- 'Cargo.lock'
- 'crates/**_parser/**/*.rs'
- 'crates/**_formatter/**/*.rs'
- 'crates/**_analyze/**/*.rs'
- 'crates/biome_grit_patterns/**/*.rs'
push:
branches:
- main
paths:
- 'Cargo.lock'
- 'crates/**_parser/**/*.rs'
- 'crates/**_formatter/**/*.rs'
- 'crates/**_analyze/**/*.rs'
- 'crates/biome_grit_patterns/**/*.rs'

We should update them, and trigger it also for biome_package and biome_configuration

interesting, GitHub action disallows top level yaml vars, wanted to define 'paths' as a peer of 'on', but not allowed,
this seems to be the only way to do it - first use of 'paths' also defines the var itself

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Jul 6, 2025

CodSpeed Performance Report

Merging #6732 will improve performances by 53.09%

Comparing vladimir-ivanov:fix/useReadonlyClassProperties-check-get-for-mutation (9b8e1d2) with main (2649ac6)

Summary

⚡ 2 improvements
✅ 112 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
deserialize_from_json_str[package.json] 1,041 µs 931 µs +11.81%
deserialize_from_json_str[tsconfig.json] 218.6 µs 142.8 µs +53.09%

Copy link
Copy Markdown
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Just one tiny change because I fear we could get a slight performance regression in the resolver otherwise.

Comment thread crates/biome_resolver/src/lib.rs Outdated
@vladimir-ivanov vladimir-ivanov changed the title perf(biome_package): use readonly class properties check get for mutation perf(biome_package): improve performance of biome_package Jul 7, 2025
"@biomejs/biome": patch
---

Improved performance of the `biome_package` parser [#6281](https://github.com/biomejs/biome/issues/6281) by filtering out unnecessary JSON entries in package.json.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changesets are meant for end users. This means that we should craft their content for them. In this case, biome_package isn't something that users know about. Instead, we could just say that we improved the performance of parsing and deserialisation of the package.json files.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Comment thread crates/biome_package/src/node_js_package/package_json.rs Outdated
Comment thread crates/biome_package/src/node_js_package/package_json.rs Outdated

pub(crate) raw_json: JsonObject,
pub author: Option<JsonValue>,
pub exports: Option<JsonValue>,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely not for this PR, but we could evaluate a better deserialisation based on the docs https://nodejs.org/api/packages.html#package-entry-points

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we raise a task for it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it's a good idea

Comment thread crates/biome_package/src/node_js_package/package_json.rs
Comment thread .changeset/package_json_parse_improve.md Outdated
@arendjr arendjr merged commit 31e4396 into biomejs:main Jul 7, 2025
27 checks passed
@github-actions github-actions Bot mentioned this pull request Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Project Area: project A-Resolver Area: resolver L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants