perf(es/codegen,es/utils): Migrate to dragonbox_ecma for faster Number::toString#11412
Conversation
🦋 Changeset detectedLatest commit: 3737ddd The changes in this PR will be included in the next version bump. 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 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
CodSpeed Performance ReportMerging #11412 will not alter performanceComparing Summary
|
Binary Sizes
Commit: c50e9b7 |
There was a problem hiding this comment.
Pull request overview
This PR migrates from the ryu-js library to the dragonbox_ecma library for converting f64 numbers to JavaScript strings, with the goal of improving performance.
Key Changes:
- Replaced
ryu_js::Bufferwithdragonbox_ecma::Bufferin number-to-string conversion code - Updated dependencies in
swc_ecma_utilsandswc_ecma_codegencrates - Added
dragonbox_ecmaversion 0.1.0 to workspace dependencies
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/swc_ecma_utils/src/number.rs |
Updated ToJsString::to_js_string() to use dragonbox_ecma::Buffer instead of ryu_js::Buffer |
crates/swc_ecma_codegen/src/lit.rs |
Updated Print::print() for f64 to use dragonbox_ecma::Buffer instead of ryu_js::Buffer |
crates/swc_ecma_utils/Cargo.toml |
Replaced ryu-js dependency with dragonbox_ecma and reformatted dependency alignment |
crates/swc_ecma_codegen/Cargo.toml |
Replaced ryu-js dependency with dragonbox_ecma, reformatted dependencies, and moved swc_sourcemap to dev-dependencies |
Cargo.toml |
Added dragonbox_ecma = "0.1.0" to workspace dependencies |
Cargo.lock |
Updated lock file to include dragonbox_ecma and remove ryu-js references |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Is it really faster in real world workload? I can't find any differences in codspeed |
|
oxc-project/oxc#12821 shows a ~4% codegen improvement when introducing dragonbox, but that result was based on dragonbox v0.0.5. This PR uses v0.1.0 instead, so the results are not directly comparable. The lack of a visible improvement could be due to a performance regression between versions or simply benchmark noise. I'll open a anther PR that introduces dragonbox at v0.0.5 and re-runs Codespeed for an apples-to-apples comparison. |
Description:
BREAKING CHANGE:
Related issue (if exists):