Skip to content

Commit

Permalink
Add babel-minify benchmark
Browse files Browse the repository at this point in the history
Closes #55 and #56.
  • Loading branch information
vigneshshanmugam authored and mathiasbynens committed Jun 5, 2018
1 parent 0f098f5 commit 0744566
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Running Web Tooling Benchmark 0.3.2...
--------------------------------------
acorn: 6.06 runs/sec
babel: 6.23 runs/sec
babel-minify: 4.88 runs/sec
babylon: 6.73 runs/sec
buble: 5.19 runs/sec
chai: 9.60 runs/sec
Expand Down
11 changes: 8 additions & 3 deletions docs/in-depth.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Note that this explicitly excludes the [Babylon](https://github.com/babel/babylo
and only measures the throughput of the actual transformations. The parser is tested
separately by the `babylon` benchmark below.

## babel-minify

[Babel Minify](https://github.com/babel/minify) is an ES2015+ aware minifier based on the Babel toolchain. It is written as a set of Babel plugins.

This benchmark stresses the babel minifier on the (concatenated) JavaScript source for the ES2015 test in the [Speedometer](https://browserbench.org/Speedometer) 2.0 benchmark.

## babylon

[Babylon](https://github.com/babel/babylon) is the frontend for the Babel transpiler and
Expand Down Expand Up @@ -198,9 +204,8 @@ compressor and beautifier toolkit, which is commonly used to minimize JavaScript
bundles.

This benchmark runs the UglifyJS minifier on the (concatenated) JavaScript source for
the ES2015 test in the [Speedometer](https://browserbench.org/Speedometer) 2.0 benchmark.
the ES2015 test in the [Lodash](https://lodash.com) module.

## uglify-es

This benchmark stresses the new ES2015 and beyond minifier using the 196KiB
ES2015 module containing the untranspiled [Vue](https://github.com/vuejs/vue) bundle.
This benchmark stresses the new ES2015 and beyond minifier on the (concatenated) JavaScript source for the ES2015 test in the [Speedometer](https://browserbench.org/Speedometer) 2.0 benchmark.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@babel/standalone": "7.0.0-beta.32",
"acorn": "5.5.3",
"autoprefixer": "8.2.0",
"babel-minify": "0.4.3",
"babylon": "7.0.0-beta.32",
"benchmark": "^2.1.4",
"buble": "0.19.3",
Expand Down
25 changes: 25 additions & 0 deletions src/babel-minify-benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

const babelMinify = require("babel-minify");
const fs = require("fs");

const payloads = [
{
name: "speedometer-es2015-test-2.0.js",
options: {}
}
].map(({ name, options }) => ({
payload: fs.readFileSync(`third_party/${name}`, "utf8"),
options
}));

module.exports = {
name: "babel-minify",
fn() {
return payloads.map(({ payload, options }) =>
babelMinify(payload, options)
);
}
};
8 changes: 8 additions & 0 deletions src/babel-minify-benchmarkt.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

const babelMinifyBenchmark = require("./babel-minify-benchmark");

it("babel-minify-benchmark runs to completion", () =>
void babelMinifyBenchmark.fn());
1 change: 1 addition & 0 deletions src/cli-flags-helper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const targetList = new Set([
"acorn",
"babel",
"babel-minify",
"babylon",
"buble",
"chai",
Expand Down

0 comments on commit 0744566

Please sign in to comment.