https://github.com/web-infra-dev/bundler-benchmark
https://github.com/web-infra-dev/bundler-benchmark
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/web-infra-dev/bundler-benchmark
- Owner: web-infra-dev
- Created: 2023-02-28T09:52:29.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-22T09:30:58.000Z (about 2 years ago)
- Last Synced: 2025-03-23T13:02:22.832Z (over 1 year ago)
- Language: JavaScript
- Size: 3.02 MB
- Stars: 12
- Watchers: 7
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This repository is based on https://github.com/webpack/benchmark
# Usage
`./scripts/bench-all.sh ${platform}`
**example**
```bash
./scripts/bench-all.sh linux
```
If you only want run specific benchmark in some case, make sure you export `BENCHMARK_PLATFORM` variable
**example**
```bash
export BENCHMARK_PLATFORM=mac
```
# Case
## all
A combination of `atlaskit-editor`, `common-libs`, `common-libs-chunks`, `rome`
## atlaskit-editor
Basic react application with `@atlaskit/editor-core`
## common-libs
A combination of some widely used libraries in Javascript ecosystem.
## common-libs-chunks
Same as `common-libs`, but using async `import()` syntax to force bundler generate multiple chunks.
## rc-1000
1000 react components (each component have 200 line of code) to simulate real application in development mode and production mode.
## rc-10000-hmr
10000 react components (each component only have basic skeleton, complicated application rerender time may greater than hmr time) to test hot module replacement performance of each devServer of bundler.
## rome
# Configuration
Using swc loader and swc minifier that could maximize performance of each bundler which is same as in `rspack` internally.
**webpack**
```diff
module.exports = {
optimization: {
+ minimizer: [
+ new TerserPlugin({
+ minify: TerserPlugin.swcMinify,
+ // `terserOptions` options will be passed to `swc` (`@swc/core`)
+ // Link to options - https://swc.rs/docs/config-js-minify
+ terserOptions: {},
+ }),
+ ],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: /(node_modules|bower_components)/,
use: {
- loader: "ts-loader",
+ loader: "swc-loader",
+ options: {
+ jsc: {
+ parser: {
+ syntax: "typescript",
+ },
+ },
+ },
},
},
],
},
};
```
**parcel**
```diff
+{
+ "extends": "@parcel/config-default",
+ "optimizers": { "*.js": ["@parcel/optimizer-swc"] }
+}
```
We have't replace the transformer because parcel has used swc internally to [speed up them transformation](https://parceljs.org/blog/beta3/)
# Credits
Thanks to:
[@sokra](https://github.com/sokra) for the great work on the [webpack/benchmark](https://github.com/webpack/benchmark) project.