forked from babel/babel
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from babel/main
[pull] main from babel:main
- Loading branch information
Showing
43 changed files
with
12,239 additions
and
257 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
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
25 changes: 25 additions & 0 deletions
25
packages/babel-generator/benchmark/many-empty-statements/bench.mjs
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,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
25
packages/babel-generator/benchmark/many-identifiers/1-length.mjs
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,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
25
packages/babel-generator/benchmark/many-identifiers/25-length.mjs
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,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(); |
Oops, something went wrong.