Skip to content

Tests: PMREMGenerator benchmark (tracking, on top of the compute PMREM PR) - #2

Open
DennisSmolek wants to merge 1 commit into
pmrem-computefrom
pmrem-benchmark
Open

DennisSmolek wants to merge 1 commit into
pmrem-computefrom
pmrem-benchmark

Conversation

@DennisSmolek

@DennisSmolek DennisSmolek commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Tracking PR for the benchmark behind the compute PMREMGenerator PR. The base, pmrem-compute, is the branch the upstream PR is opened from, so this diff shows only the benchmark (one commit, c7afb22292). It's here to review and cherry-pick, and could become a follow-up upstream PR if maintainers want it in the repo.

What it is

npm run benchmark-pmrem loads one page, test/benchmarks/pmrem/pmrem.html, against the src/ of several builds and compares them. A build is any git ref, extracted with git archive into node_modules/.cache/, or . for the working tree. The page takes its three.js from ?src=, so every build runs the exact same page. It follows test/benchmarks/proxy-node-material: puppeteer plus utils/server.js, with no new dependencies.

npm run benchmark-pmrem -- builds=upstream/dev,. runs=5
npm run benchmark-pmrem -- builds=upstream/dev,bhouston/pmrem-min-size,. cases=bake
npm run benchmark-pmrem -- builds=upstream/dev cases=readback captures=<directory of raw cubes>
Case Measures
bake fromCubemap() into a persistent target, as PMREMNode does for a dynamic environment, at 64 to 1024
cold the first bake of a page, including shader compilation
scene fromScene() at reflection probe sizes
equirect fromEquirectangular() of a 1K HDR
sampling the cost of materials sampling the PMREM: 400 spheres at 1920×1080
readback every mip level read back and compared texel by texel against the first build: relative luminance error (mean, p99, max) and the share of bit-identical texels

The timings are burst wall-clock: N calls, one onSubmittedWorkDone(), divided by N. The table keeps the minimum over page loads, and the builds rotate between runs. readback can take raw rgba16f cubes (captures=) in place of the procedural SkyMesh source. That's how the real-sky parity table in the PR was made, with the captures from pmndrs/sky.

Things it caught

  • SkyMesh clouds move with time. Without freezing them, each page rendered a slightly different sky, and the readback measured the clock, not the filter. The page sets cloudSpeed to 0.
  • Comparing builds needs a fixed base. A branch based on an older dev showed differences that came from unrelated commits. Compare against the merge base, or against branches on the same base.

Example output

Apple M5 Pro, Chrome 155 (Metal), builds=upstream/dev,bhouston/pmrem-min-size,.,bench/compute-min64 runs=5, abridged:

Input Build Output ms
64 upstream/dev 256² × 6 mips 4.59
64 mrdoob#35048 64² × 4 mips 2.45
64 compute 256² × 6 mips 1.18
64 compute + mrdoob#35048 64² × 4 mips 0.75
256 upstream/dev 256² × 6 mips 4.60
256 compute 256² × 6 mips 1.17

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

📦 Bundle size

Full ESM build including core, minified and gzipped.

Before After Diff
Core 392.32
102.83
393.38
103.03
+1.06 kB
+195 B
WebGL 778.74
194.39
779.69
194.55
+955 B
+160 B
WebGPU 1104.05
297.16
1113.05
299.72
+9 kB
+2.56 kB
WebGPU Nodes 1102.00
296.81
1111.00
299.36
+9 kB
+2.55 kB

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 518.96
124.67
518.86
124.64
-103 B
-29 B
WebGPU 782.38
209.41
793.49
212.68
+11.11 kB
+3.27 kB
WebGPU Nodes 728.48
195.98
739.59
199.19
+11.11 kB
+3.2 kB

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant