lab.Independent engineering
by Kristian Salmeron
PDF LOADING / LAB 001Back to the overview

Make the experiment
repeatable.

The same inputs. A pinned source revision. A record of your own environment and every outcome.

BEFORE YOU START

A new attempt, in a fresh workspace.

Use a terminal on macOS or Linux, Node 24.x, Python 3.11 or newer, qpdf, Poppler and unzip. Leave enough room for Chromium and 100-page validation images. No website hosting or account is needed.

The first-page baseline is the easiest entry point. Controlled delivery adds stricter calibration and audit gates. Neither command replays the final campaign’s reserved time slots.

Tools and environment details

The source declares Node 24.22.3 and pnpm 11.28.12. The measured environment used Node 24.22.1, Python 3.13.18 and qpdf 12.4.2. PDF.js is pinned to 5.6.205 and Playwright to 1.62.1; Playwright selects its Chromium revision.

Install qpdf and Poppler through your system package manager, with qpdf and pdftoppm on PATH. On macOS with Homebrew, use brew install qpdf poppler; on Debian/Ubuntu, sudo apt-get install qpdf poppler-utils unzip. Record the versions actually installed. Linux may also need Playwright’s documented Chromium system dependencies.

Different operating systems, fonts or runtimes define a different environment. A matching setup does not guarantee identical timings. These commands create independent evidence, not a claim to reproduce the original machine exactly.

Full environment and corpus setup

01 / PREPARE

Pin the code before you measure.

Run this in a directory where pdf-lab-001 does not already exist. The checkout uses the reviewed source revision, so a later change to main cannot silently alter your attempt.

Create a separate workspace
git clone https://github.com/kriscodes/pdf-rendering-benchmark.git pdf-lab-001 &&
cd pdf-lab-001 &&
git checkout --detach 0feddfba7a62a556a25cc2ddcab324cf67892fc0 &&
npm install --global pnpm@11.28.12 &&
pnpm install --frozen-lockfile &&
python3 -m venv .venv &&
.venv/bin/python -m pip install -r packages/corpus/requirements.txt &&
pnpm --filter @pdf-benchmark/runner exec playwright install chromium --only-shell

Keep this terminal open in the repository root for the following steps. Do not install or build inside an active measurement checkout.

02 / USE THE SAME INPUTS

Download, then verify the pair.

These are the original synthetic PDFs, copied without modification. Download the ZIP and move it into the pdf-lab-001 folder you just created.

Download the original corpusTwo 100-page PDFs + manifest · ZIP
Unpack and verify the corpus
mkdir -p corpus/generated/pilot &&
unzip pdf-lab-001-corpus.zip -d corpus/generated/pilot &&
qpdf --version &&
pdftoppm -v &&
.venv/bin/python --version &&
node --version &&
pnpm --version &&
pnpm corpus:verify

The verifier checks hashes and qpdf structure, repeats generation, and compares all pages at 144 DPI. Inspect its saved samples of pages 1, 50 and 100 for layout defects. These checks establish input correctness, not performance.

Inspect individual files and SHA-256 checksums

Nonlinearized PDF

86,329 bytes · 100 pages

d9ad470b1f56976f907aad64712c2269b380cb0af7e52a5c3670dc3290af162a

Linearized PDF

87,189 bytes · 100 pages

efb5faa8018ec5a2b508eb703d55fa39e8cb4746b6aad29d05a841b6c3cf874a

Corpus ZIP

c0cd7cbcbf68a40e6abd6e7ed08bccabf172bdc80be693fe8df057c0bd63995a
Download the unchanged manifest

To investigate generation itself, use the generator protocol in a separate directory. Do not replace the downloaded originals. Toolchain differences can change generated bytes; retain and investigate any failed verification.

03 / START SIMPLE

Run the first-page baseline.

Close competing workloads, keep the machine awake and let the trials run serially. Do this only after the corpus checks pass.

Run the local first-page baseline
pnpm bench:first-page

What to expect

Four excluded warmup trials, then 20 measured trials in balanced pairs. Each trial uses a fresh browser context. A new directory under results/raw/first-page-local/ retains report.json and sample images.

This baseline uses a 65,536-byte range chunk. Both PDFs are too small to enable PDF.js range loading at that setting, so it measures full-response loading. It cannot establish a range-delivery benefit.

The primary metric is firstPageRenderMs: immediately before getDocument() through page 1’s render().promise. Compare paired differences only from a complete, valid run. Do not treat a nonzero exit as a successful comparison.

Full baseline protocol and controls

04 / GO DEEPER

Add controlled delivery.

This is a separate four-condition experiment, not an extra baseline repeat. Read the protocol before running it. Keep the original PDFs and the declared settings unchanged.

PDF response headers
100 ms delay
Shared body budget
125,000 bytes/s · 1 Mbit/s
Range chunk
16,384 bytes
Scheduled trials
16 warmups + 48 measured
Calibrate and run controlled delivery
pnpm --filter @pdf-benchmark/runner build &&
node packages/runner/dist/controlled-delivery.js --calibrate-only &&
mkdir -p results/raw/controlled-delivery &&
run_dir="$(mktemp -d "$PWD/results/raw/controlled-delivery/replicate.XXXXXX")" &&
node packages/runner/dist/controlled-delivery.js --output-dir "$run_dir"

Run one attempt after calibration passes. Both the calibration-only invocation and the performance runner retain their own evidence. A rejected performance attempt may stop early; do not retry until something passes or widen a tolerance.

Independently audit the attempt
# In the same terminal, after the controlled-delivery attempt:
test -n "$run_dir" &&
audit_dir="$(mktemp -d "$PWD/results/raw/manual-audit.XXXXXX")" &&
.venv/bin/python packages/runner/scripts/summarize_controlled_delivery.py \
  "$run_dir/report.json" \
  --output-prefix "$audit_dir/summary" \
  --audit-json "$audit_dir/audit.json"

The explicit audit path is intentional: the legacy command’s default uses a shared temporary filename. Keep it in the new private directory shown above. The auditor rejects incomplete evidence and writes comparison exports only after acceptance.

Read every control and acceptance gate

05 / KEEP THE RECORD

Share an attempt someone can inspect.

  • The source revision, PDF hashes, configuration and exact command.
  • Your OS, hardware, Node, Python, qpdf, PDF.js, Playwright and actual Chromium versions.
  • All raw trials, excluded warmups, errors, calibration records and audit output.
  • Sample images and your notes on correctness, background activity and departures from the protocol.
  • The outcome, including rejection or insufficient evidence. Keep separate environments and protocols separate.

Archive the whole output directory before any new attempt. Choose the number and timing of repeats in advance. A reader’s attempt never becomes one of the original campaign’s calendar windows.

Compare the structure of our record

WHEN SOMETHING DOES NOT PASS

A failure is still evidence.

Chromium is missing or will not launch

Re-run the pinned Playwright install command from step 1 and check the system dependencies for your OS. Do not silently substitute another browser. If you use an executable override, record its exact path and version; it defines a different environment.

Corpus verification fails

Keep the failed report. Compare file hashes and tool versions, confirm qpdf and Poppler are on PATH, and inspect retained page images. Do not edit the manifest or regenerate the downloaded pair to hide the mismatch.

The run or clock gate rejects the attempt

Retain partial trials and the rejection reason. Do not summarize them as an accepted timing result. Investigate separately, then declare any changed protocol or new schedule before collecting new measurements.

Can I run the original fixed-window launcher?

Its plan is tied to preserved files, absolute runtime paths and three calendar slots on the original machine. It is not a portable quick start. Follow the independent runner instructions above; use the final protocol as a reference when declaring your own schedule.

What makes a finding worth publishing?

A method you can repeat, raw measurements you can inspect, and limits stated alongside the conclusion. An attempted measurement is not automatically an accepted finding. Read the publication standards.