Add experimental PDFViewer-PDFjs workload (#590)

* Fix BenchmarkConnector call to console.warning

Opening any remote workload outside the harness threw a TypeError on the
first stray message instead of logging it.

Note that I didn't rebuild the existing remote workloads. I checked the
others and it looks like they show a bit diff in the bundle, so I chose
to leave them for now. The next rebuild will take this up.

* Fix AsyncBenchmarkStep never awaiting its step

`StepRunner` only awaited the step body when its "type" argument was
"async". `AsyncBenchmarkStep` created an `AsyncStepRunner` without passing
that argument, so the step promise was never awaited and an async remote
step measured ~0ms with no error.

This commit makes the runner class decide instead: an `isAsync` getter
is false on `StepRunner` and true on `AsyncStepRunner`, and the type
argument is removed. Sync steps stay a plain call, since awaiting them
would add a microtask hop to the measured time.

The bug was never hit because nothing in the tree or in the open
workload PRs uses `AsyncBenchmarkStep`. But this is a requirement for
the pdf.js workload that I'm working on.

* Add the PDFViewer-PDFjs experimental workload

A document viewer on the pdf.js core API. It covers work like: canvas 2D
drawing, rasterising glyphs from embedded fonts and JPEG decoding. The
suite is `remote` with a single async step that renders `6
* complexity` pages and their thumbnails.

Decisions worth knowing about:

- It uses the core API rather than pdf.js' `pdf_viewer.mjs`, whose render
  queue and scroll handling schedule work with setTimeout that would land
  inside the measured step.
- pdf.js continues each render chunk on requestAnimationFrame, which ties
  the step to the display's refresh rate. The step swaps rAF for a timer
  while it runs, and restores it after.
- Nothing is rendered before the step, since pdf.js caches operator lists
  per page and an early render would leave the step a warm cache.
- The fixture PDF is generated at build time with PDFKit, so its content is
  reviewable as code and byte-identical between builds.

* Build and enable the PDFViewer-PDFjs workload

* Enable hardware-accelerated canvas in the PDFViewer-PDFjs workload

pdf.js defaults enableHWA to false, which makes it create every page and
scratch canvas context with willReadFrequently: true. Browsers keep those
canvases off the GPU, so the workload only measured software rasterization,
unlike the pdf.js viewer that ships in Firefox.

* Run the Safari CI jobs with Safari Technology Preview

The Safari that ships on GitHub's Apple silicon macOS images (27.2 at
the time of writing) throws InvalidStateError on any pixel readback from
a hardware-accelerated 2D canvas inside the virtual machine. pdf.js
reads page canvases back on WebKit, which has no ctx.filter, so
PDFViewer-PDFjs fails the Safari e2e there while real hardware runners
pass. WebKit trunk no longer does this. Safari Technology Preview 255
passes the full e2e on the same image.

Install Safari Technology Preview in the Safari job and let the test
helper drive it when SAFARI_TECHNOLOGY_PREVIEW=1 is set. Local runs keep
using the installed Safari unless the variable is exported.
34 files changed
tree: d691824ad330ff205f3d93ba15ba3219d7211f3c
  1. .github/
  2. resources/
  3. suites/
  4. suites-experimental/
  5. tests/
  6. .eslintignore
  7. .eslintrc
  8. .gitignore
  9. .npmpackagejsonlintrc.json
  10. .npmrc
  11. .nvmrc
  12. .prettierignore
  13. .prettierrc
  14. about.html
  15. babel.config.json
  16. Development.md
  17. Governance.md
  18. index.html
  19. instructions.html
  20. LICENSE
  21. netlify.toml
  22. package-lock.json
  23. package.json
  24. README.md
  25. Testing.md
README.md

What is Speedometer?

Speedometer is a benchmark for web browsers that measures Web application responsiveness by timing simulated user interactions on various workloads. Our primary goal is to make it reflect the real-world Web as much as possible. When a browser improves its score on the benchmark, actual users should benefit. In order to achieve this, it should:

  • Test end-to-end user journeys instead of testing specific features in a tight loop. Each test should exercise the full set of what’s needed from the engine in order for a user to accomplish a task.
  • Evolve over time, adapting to the present Web on a regular basis. This should be informed by current usage data, and by consensus about features which are important for engines to optimize to provide a consistent experience for users and site authors.
  • Be accessible to the public and useful to browser engineers. It should run in every modern browser by visiting a normal web page. It should run relatively quickly, while providing enough test coverage to be reflective of the real-world Web.

Score and Test Measurement

Each test can contain several steps who contributed to the test duration. Note that the prepare step of a test is unmeasured and thus does not contribute to the score. All following test steps are measured and summed up in the test step time.

Each step consists of the following phases:

Score

The final benchmark score is calculated based of the inverse of geomean of all tests. We average the score over multiple iterations with the arithmetic mean. By using the geomean to combine the test durations we maintain the invariant that relative improvements are favoured equally amongst all tests, even though they can have vastly different durations.