Skip to content
Merged
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 29 additions & 0 deletions gulpfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down
Loading