-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: bump
string_wizard
for better performance (#292)
<!-- Thank you for contributing! --> ### Description rolldown/string_wizard#9 The problem is that bundling cjs module requre calling `MagicString#indent`, which was incredibly slow due to lacking of optimization: rolldown/string_wizard@4515818. ``` ┌─────────┬────────────────────┬─────────┬───────────────────┬───────────┬─────────┐ │ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │ ├─────────┼────────────────────┼─────────┼───────────────────┼───────────┼─────────┤ │ 0 │ 'rolldown-threejs' │ '109' │ 9110844.725912267 │ '±10.05%' │ 11 │ │ 1 │ 'esbuild-threejs' │ '52' │ 19223512.59738207 │ '±13.03%' │ 10 │ └─────────┴────────────────────┴─────────┴───────────────────┴───────────┴─────────┘ ┌─────────┬───────────────────────┬─────────┬────────────────────┬───────────┬─────────┐ │ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │ ├─────────┼───────────────────────┼─────────┼────────────────────┼───────────┼─────────┤ │ 0 │ 'rolldown-threejs10x' │ '9' │ 102347845.79873085 │ '±10.12%' │ 10 │ │ 1 │ 'esbuild-threejs10x' │ '5' │ 166986120.80067396 │ '±3.19%' │ 10 │ └─────────┴───────────────────────┴─────────┴────────────────────┴───────────┴─────────┘ ┌─────────┬────────────────────────────────┬─────────┬────────────────────┬──────────┬─────────┐ │ (index) │ Task Name │ ops/sec │ Average Time (ns) │ Margin │ Samples │ ├─────────┼────────────────────────────────┼─────────┼────────────────────┼──────────┼─────────┤ │ 0 │ 'rolldown-react_and_react_dom' │ '49' │ 20094408.302009106 │ '±5.22%' │ 10 │ │ 1 │ 'esbuild-react_and_react_dom' │ '45' │ 21785495.999455452 │ '±3.87%' │ 10 │ └─────────┴────────────────────────────────┴─────────┴────────────────────┴──────────┴─────────┘ ``` <!-- Please insert your description here and provide especially info about the "what" this PR is solving --> ### Test Plan <!-- e.g. is there anything you'd like reviewers to focus on? --> ---
- Loading branch information
Showing
21 changed files
with
101 additions
and
38 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
crates/rolldown/tests/fixtures/misc/generate_valid_name_for_kebab_case_files/artifacts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
source: crates/rolldown/tests/common/case.rs | ||
expression: content | ||
input_file: crates/rolldown/tests/fixtures/misc/generate_valid_name_for_kebab_case_files | ||
--- | ||
# Assets | ||
|
||
## main.mjs | ||
|
||
```js | ||
import { __commonJS } from "./_rolldown_runtime.mjs"; | ||
// react-dom.js | ||
var require_react_dom = __commonJS({ | ||
'react-dom.js'(exports, module) { | ||
module.exports = 'react-dom' | ||
} | ||
}); | ||
export default require_react_dom(); | ||
``` |
1 change: 1 addition & 0 deletions
1
crates/rolldown/tests/fixtures/misc/generate_valid_name_for_kebab_case_files/react-dom.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'react-dom' |
10 changes: 10 additions & 0 deletions
10
...es/rolldown/tests/fixtures/misc/generate_valid_name_for_kebab_case_files/test.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"input": { | ||
"input": [ | ||
{ | ||
"name": "main", | ||
"import": "./react-dom.js" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"name": "bench", | ||
"private": true, | ||
"type": "module", | ||
"scripts": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters