Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmark for ESLint #67

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Running Web Tooling Benchmark v0.5.2…
buble: 4.77 runs/s
chai: 14.47 runs/s
coffeescript: 5.62 runs/s
eslint: 2.35 runs/s
espree: 4.05 runs/s
esprima: 6.68 runs/s
jshint: 7.84 runs/s
Expand Down
14 changes: 14 additions & 0 deletions docs/in-depth.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,20 @@ popular.
This benchmark runs the CoffeeScript compiler on the [`lexer.coffee`](https://github.com/v8/web-tooling-benchmark/blob/third_party/coffeescript-lexer-2.0.1.coffee)
file from the CoffeeScript 2.0.1 distribution.

## eslint

[ESLint](https://eslint.org/) is an open source project that helps developers find and
fix problems with their JavaScript code. This is done by code linting, which
identifies problematic patterns or code that does not find certain style guidelines.
ESLint was created to allow developers to use their own set of linting rules, and therefore,
is designed to have all rules completely pluggable.

This benchmark runs ESLint on
- the [JSHint](https://jshint.com/) v2.1.8 distribution,
- the [lodash](https://lodash.com/) v4.17.4 bundle,
- the [Preact](http://preactjs.com/) v8.2.5 bundle,
- and the [underscore](http://underscorejs.org/) v1.8.3 distribution.

## espree

[Espree](https://github.com/eslint/espree) started out as a fork of Esprima v1.2.2,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"chai": "4.1.2",
"coffeescript": "2.2.3",
"compute-gmean": "^1.1.0",
"eslint": "5.15.0",
"espree": "3.5.4",
"esprima": "4.0.0",
"jshint": "2.9.7",
Expand Down
1 change: 1 addition & 0 deletions src/cli-flags-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const targetList = new Set([
"buble",
"chai",
"coffeescript",
"eslint",
"espree",
"esprima",
"jshint",
Expand Down
26 changes: 26 additions & 0 deletions src/eslint-benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2019 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 fs = require("fs");
const CLIEngine = require("eslint").CLIEngine;
const cli = new CLIEngine({
useEslintrc: false,
extends: "eslint:recommended"
});

const payloads = [
"jshint.js",
"lodash.core-4.17.4.js",
"preact-8.2.5.js",
"underscore-1.8.3.js"
].map(name => fs.readFileSync(`third_party/${name}`, "utf8"));

module.exports = {
name: "eslint",
fn() {
return payloads.forEach(payload => {
cli.executeOnText(payload);
});
}
};
7 changes: 7 additions & 0 deletions src/eslint-benchmark.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright 2019 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 eslintBenchmark = require("./eslint-benchmark");

it("eslint-benchmark runs to completion", () => void eslintBenchmark.fn());
4 changes: 4 additions & 0 deletions src/vfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ fs.writeFileSync(
"third_party/jquery-3.2.1.js",
require("raw-loader!../third_party/jquery-3.2.1.js")
);
fs.writeFileSync(
"third_party/jshint.js",
require("raw-loader!../third_party/jshint.js")
);
fs.writeFileSync(
"third_party/coffeescript-lexer-2.0.1.coffee",
require("raw-loader!../third_party/coffeescript-lexer-2.0.1.coffee")
Expand Down
Loading