Skip to content

Commit

Permalink
Merge pull request #4 from babel/main
Browse files Browse the repository at this point in the history
[pull] main from babel:main
  • Loading branch information
devkadirselcuk authored Jul 26, 2021
2 parents 0edc93b + 4a56387 commit c2b31fc
Show file tree
Hide file tree
Showing 43 changed files with 12,239 additions and 257 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FLOW_COMMIT = a1f9a4c709dcebb27a5084acf47755fbae699c25
TEST262_COMMIT = afe217b318df5f197e64b30a8b5a4b391c777359
TEST262_COMMIT = 6e2a29417ad52ba114c26838a288510d704efa1b
TYPESCRIPT_COMMIT = 3de706a8525c2ded782fc032fa4afe2e485100d3

# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
Expand Down
4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ module.exports = function (api) {
plugins: ["babel-plugin-transform-charcodes"],
assumptions: parserAssumptions,
},
{
test: ["packages/babel-generator"].map(normalize),
plugins: ["babel-plugin-transform-charcodes"],
},
convertESM && {
test: [
"./packages/babel-cli",
Expand Down
25 changes: 25 additions & 0 deletions packages/babel-generator/benchmark/many-empty-statements/bench.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/generator";
import current from "../../lib/index.js";
import parser from "@babel/parser";
import { report } from "../util.mjs";

const suite = new Benchmark.Suite();

function createInput(length) {
return parser.parse(";".repeat(length));
}

function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} empty statements`, () => {
implementation(input, options);
});
}
}

benchCases("baseline", baseline.default);
benchCases("current", current.default);

suite.on("cycle", report).run();
25 changes: 25 additions & 0 deletions packages/babel-generator/benchmark/many-identifiers/1-length.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/generator";
import current from "../../lib/index.js";
import parser from "@babel/parser";
import { report } from "../util.mjs";

const suite = new Benchmark.Suite();

function createInput(length) {
return parser.parse("a;".repeat(length));
}

function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} 1-length identifiers`, () => {
implementation(input, options);
});
}
}

benchCases("baseline", baseline.default);
benchCases("current", current.default);

suite.on("cycle", report).run();
25 changes: 25 additions & 0 deletions packages/babel-generator/benchmark/many-identifiers/25-length.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Benchmark from "benchmark";
import baseline from "@babel-baseline/generator";
import current from "../../lib/index.js";
import parser from "@babel/parser";
import { report } from "../util.mjs";

const suite = new Benchmark.Suite();

function createInput(length) {
return parser.parse("parseMaybeImportAssertion;".repeat(length));
}

function benchCases(name, implementation, options) {
for (const length of [256, 512, 1024, 2048]) {
const input = createInput(length);
suite.add(`${name} ${length} 25-length identifiers`, () => {
implementation(input, options);
});
}
}

benchCases("baseline", baseline.default);
benchCases("current", current.default);

suite.on("cycle", report).run();
Loading

0 comments on commit c2b31fc

Please sign in to comment.