bhouston/webgpu-bench

WebGPU Benchmarking Library

TypeScript

9

113 commits

updated Sep 30, 2026

See the code

README

webgpu-bench (monorepo)

CI Coverage npm Live demo Discord

A microbenchmark suite for WebGPU: it isolates and benchmarks a device's raw ceilings — memory bandwidth (read/write) and FLOPS (fp32, fp16, int8; scalar/vec4/mat4/matvec) — one operation at a time in the browser, plus fixed-work comparisons of shader techniques such as layouts, workgroup sizes, reductions, and atomic aggregation. It is not a full app or game benchmark.

Try it live on the Web3D Survey: GPU Benchmark page. Read the announcement post.

This is a micro-benchmark, not a game or app benchmark: it tells you the raw cost of specific operations (a memory read, an fp32 FMA, an int8 dot product, a divergent branch) on your GPU, so you can make better-informed decisions when writing shaders — and understand how those costs differ across devices. Use it as a CLI or as a library embedded in your own tools.

Packages

  • packages/core — webgpu-bench-core, the benchmark suite (WGSL shaders, data generation, timing harness, orchestration). Framework-agnostic, browser-only, consumed as TypeScript source. See its README.
  • packages/cli — webgpu-bench command-line runner (WebGPU via Dawn, no browser needed). See its README.

Screenshots

webgpu-bench CLI running webgpu-bench CLI results for a filtered run Web3D Survey results generated by webgpu-bench

Development

Follow CONTRIBUTING.md for the issue, branch, PR, and release workflow. See release setup for npm trusted publishing.

pnpm install
pnpm exec playwright install chromium webkit
pnpm build
pnpm lint
pnpm tsc
pnpm test
pnpm test:workflow
pnpm audit --audit-level high
pnpm size

The default test command runs Chromium, Node, and CLI tests with coverage, then enforces a coverage gate. WebKit is a separate advisory CI job; pnpm test:all runs all projects locally.

pnpm --filter webgpu-bench-core test:browser   # Both browsers (macOS with WebGPU)
pnpm --filter webgpu-bench-core test:chromium # Chromium only
pnpm --filter webgpu-bench-core test:webkit   # WebKit only

Coverage and size budgets

Coverage covers all production TypeScript in both packages. CLI subprocess code isn't measured by Vitest's in-process coverage; integration tests still exercise it. Thresholds are 75% for aggregate statements, functions, and lines, and 70% for branches — raise them as coverage improves. Size Limit measures compressed compiled JavaScript, with budgets of 100 kB for core and 20 kB for CLI (external dependencies and native Dawn binaries are excluded).

Commit history predating conventional-commits adoption is not linted retroactively; the policy CI job and the pre-commit hook only check new commits.

Author

Created by Ben Houston and sponsored by Land of Assets.

benchmark
benchmarking
vgpu
webgpu

bhouston/webgpu-bench

WebGPU Benchmarking Library

TypeScript

9

113 commits

updated Sep 30, 2026

See the code

README

webgpu-bench (monorepo)

CI Coverage npm Live demo Discord

A microbenchmark suite for WebGPU: it isolates and benchmarks a device's raw ceilings — memory bandwidth (read/write) and FLOPS (fp32, fp16, int8; scalar/vec4/mat4/matvec) — one operation at a time in the browser, plus fixed-work comparisons of shader techniques such as layouts, workgroup sizes, reductions, and atomic aggregation. It is not a full app or game benchmark.

Try it live on the Web3D Survey: GPU Benchmark page. Read the announcement post.

This is a micro-benchmark, not a game or app benchmark: it tells you the raw cost of specific operations (a memory read, an fp32 FMA, an int8 dot product, a divergent branch) on your GPU, so you can make better-informed decisions when writing shaders — and understand how those costs differ across devices. Use it as a CLI or as a library embedded in your own tools.

Packages

  • packages/core — webgpu-bench-core, the benchmark suite (WGSL shaders, data generation, timing harness, orchestration). Framework-agnostic, browser-only, consumed as TypeScript source. See its README.
  • packages/cli — webgpu-bench command-line runner (WebGPU via Dawn, no browser needed). See its README.

Screenshots

webgpu-bench CLI running webgpu-bench CLI results for a filtered run Web3D Survey results generated by webgpu-bench

Development

Follow CONTRIBUTING.md for the issue, branch, PR, and release workflow. See release setup for npm trusted publishing.

pnpm install
pnpm exec playwright install chromium webkit
pnpm build
pnpm lint
pnpm tsc
pnpm test
pnpm test:workflow
pnpm audit --audit-level high
pnpm size

The default test command runs Chromium, Node, and CLI tests with coverage, then enforces a coverage gate. WebKit is a separate advisory CI job; pnpm test:all runs all projects locally.

pnpm --filter webgpu-bench-core test:browser   # Both browsers (macOS with WebGPU)
pnpm --filter webgpu-bench-core test:chromium # Chromium only
pnpm --filter webgpu-bench-core test:webkit   # WebKit only

Coverage and size budgets

Coverage covers all production TypeScript in both packages. CLI subprocess code isn't measured by Vitest's in-process coverage; integration tests still exercise it. Thresholds are 75% for aggregate statements, functions, and lines, and 70% for branches — raise them as coverage improves. Size Limit measures compressed compiled JavaScript, with budgets of 100 kB for core and 20 kB for CLI (external dependencies and native Dawn binaries are excluded).

Commit history predating conventional-commits adoption is not linted retroactively; the policy CI job and the pre-commit hook only check new commits.

Author

Created by Ben Houston and sponsored by Land of Assets.

benchmark
benchmarking
vgpu
webgpu