-
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.
feat: finish bench use @rolldown/core (#234)
- Loading branch information
Showing
7 changed files
with
103 additions
and
21 deletions.
There are no files selected for viewing
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,14 @@ | ||
const esbuild = require('esbuild') | ||
const path = require('path') | ||
|
||
async function esbuildBundle(entryPoints) { | ||
await esbuild.build({ | ||
entryPoints: entryPoints, | ||
bundle: true, | ||
outfile: 'out.js', | ||
}) | ||
} | ||
|
||
module.exports = { | ||
esbuildBundle, | ||
} |
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,26 @@ | ||
const b = require('benny') | ||
const chalk = require('chalk') | ||
const { rolldownBundle } = require('./rolldown') | ||
const { esbuildBundle } = require('./esbuild') | ||
|
||
const sleep = function () { | ||
return new Promise((resolve) => { | ||
setTimeout(() => { | ||
resolve() | ||
}, 1000) | ||
}) | ||
} | ||
|
||
module.exports = b.suite( | ||
'Suite two', | ||
|
||
b.add('rolldown/three.js', async () => { | ||
await rolldownBundle(['../temp/three.js/src/Three.js']) | ||
}), | ||
|
||
b.add('esbuild/three.js', async () => { | ||
await esbuildBundle() | ||
}), | ||
b.cycle(), | ||
b.complete(), | ||
) |
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,9 @@ | ||
{ | ||
"devDependencies": { | ||
"@rolldown/core": "0.1.4", | ||
"benchmark": "^2.1.4", | ||
"benny": "^3.7.1", | ||
"chalk": "^4", | ||
"esbuild": "^0.19.5" | ||
} | ||
} |
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,13 @@ | ||
const rolldown = require('@rolldown/core') | ||
|
||
async function rolldownBundle(input) { | ||
const bundler = await rolldown.rolldown({ | ||
input, | ||
}) | ||
let res = await bundler.generate() | ||
return res | ||
} | ||
|
||
module.exports = { | ||
rolldownBundle, | ||
} |
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,37 +1,44 @@ | ||
set shell := ["bash", "-cu"] | ||
|
||
_default: | ||
just --list -u | ||
just --list -u | ||
|
||
init: | ||
cargo binstall rusty-hook taplo-cli cargo-insta cargo-nextest -y | ||
yarn install | ||
git submodule update | ||
cargo binstall rusty-hook taplo-cli cargo-insta cargo-nextest -y | ||
yarn install | ||
git submodule update | ||
|
||
test: | ||
cargo nextest run --no-fail-fast | ||
cargo nextest run --no-fail-fast | ||
|
||
lint: | ||
cargo clippy --all -- --deny warnings | ||
cargo clippy --all -- --deny warnings | ||
|
||
# Update our local branch with the remote branch (this is for you to sync the submodules) | ||
update: | ||
git pull | ||
git submodule update --init | ||
git pull | ||
git submodule update --init | ||
|
||
fmt: | ||
cargo fmt | ||
taplo format | ||
npm run prettier | ||
cargo fmt | ||
taplo format | ||
npm run prettier | ||
|
||
bench-prepare: | ||
git clone https://github.com/mrdoob/three.js.git --depth 1 ./temp/three.js | ||
for i in {1..10}; do cp -r ./temp/three.js/src ./temp/three.js/copy$i/; done | ||
|
||
git clone https://github.com/mrdoob/three.js.git --depth 1 ./temp/three.js | ||
for i in {1..10}; do cp -r ./temp/three.js/src ./temp/three.js/copy$i/; done | ||
|
||
# build node binding | ||
build-binding mode="debug": | ||
yarn workspace @rolldown/node-binding run {{ if mode == "release" { "build:release" } else { "build" } }} | ||
|
||
bench: | ||
cargo bench -p bench | ||
cargo bench -p bench | ||
|
||
# build wasm of rolldown and move the output `pkg/` under `web` directory | ||
|
||
# Use `just wasm-build release` for better performance but also it will cost more time. | ||
wasm-build mode="dev": | ||
cd crates/rolldown_wasm && wasm-pack build --{{mode}} --target web | ||
-rm -r ./web/wasm | ||
mv crates/rolldown_wasm/pkg ./web/wasm | ||
cd crates/rolldown_wasm && wasm-pack build --{{ mode }} --target web | ||
-rm -r ./web/wasm | ||
mv crates/rolldown_wasm/pkg ./web/wasm |
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