mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-11-30 16:37:18 +01:00
Add gulp benchmark task
This commit is contained in:
@@ -176,6 +176,19 @@ types can be told apart:
|
||||
| `integration_tests.yml` | `integrationtest` | `integrationtest` |
|
||||
| `coverage_browser_tests.yml` | `botbrowsertest` | `browsertest` |
|
||||
|
||||
## Benchmarks
|
||||
|
||||
Run the benchmarks in `test/benchmarks/` locally:
|
||||
|
||||
$ npx gulp benchmark
|
||||
|
||||
To compare with `master`:
|
||||
|
||||
$ git checkout master
|
||||
$ npx gulp benchmark --output-json build/bench-master.json
|
||||
$ git checkout my-branch
|
||||
$ npx gulp benchmark --compare build/bench-master.json
|
||||
|
||||
## Using PDF.js in a web application
|
||||
|
||||
To use PDF.js in a web application you can choose to use a pre-built version of the library
|
||||
|
||||
@@ -2802,6 +2802,35 @@ gulp.task(
|
||||
)
|
||||
);
|
||||
|
||||
gulp.task("benchmark", function (done) {
|
||||
console.log("\n### Running benchmarks");
|
||||
|
||||
const args = [
|
||||
"node_modules/vitest/vitest.mjs",
|
||||
"bench",
|
||||
"--run",
|
||||
"--config",
|
||||
"test/benchmarks/vitest.config.mjs",
|
||||
];
|
||||
const outputJson = getArgValue("--output-json");
|
||||
if (outputJson) {
|
||||
args.push("--outputJson", outputJson);
|
||||
}
|
||||
const compare = getArgValue("--compare");
|
||||
if (compare) {
|
||||
args.push("--compare", compare);
|
||||
}
|
||||
|
||||
const benchProcess = startNode(args, { stdio: "inherit" });
|
||||
benchProcess.on("close", function (code) {
|
||||
if (code !== 0) {
|
||||
done(new Error("Benchmarks failed."));
|
||||
return;
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task("lint-licenses", function (done) {
|
||||
console.log("\n### Checking license headers");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user