PostBench

Methodology & Trust Architecture

How PostBench Measures Web IPC — and Why Results Are Hard to Spoof

Inspired by wasm-vs-js.com and port-authority.dev, PostBench isolates scheduling floors, serialization copies, zero-copy transfers, shared memory wakeups, and end-to-end real-world pipelines.

1. Testing the wasm-vs-js.com Hypothesis

On small control messages (64 B), Worker postMessage() and MessagePort latencies sit around 0.05–0.30 ms. When payload sizes climb to 1 MiB–16 MiB, structured cloning must allocate and copy the entire buffer across heaps while stalling the sender's postMessage() call synchronously on the main thread. Transferring ArrayBuffer ownership (postMessage(msg, [buf])) decouples the transfer latency from byte size and detaches the sender view (buf.byteLength === 0).

2. Measurement Scopes & Fair Comparisons

Scope Timer Starts / Stops What It Isolates
Cold Start Right before new Worker() → first verified pong Thread spawn, script fetch/parse, and first IPC round-trip.
RTT Latency Pre-filled payload sent → receiver verifies checksum & replies Thread wakeup, IPC serialization/deserialization, and event-loop scheduling.
Send-Block Time Immediately before → immediately after postMessage() returns Synchronous main-thread CPU freeze caused by structured cloning on the sender side.
Real-World Pipelines Full multi-step workload (500 RPCs, 20 video frames, UI-loaded relay, 8 MiB jank) End-to-end FPS, dropped requestAnimationFrame ticks, Long Animation Frames, and batching vs chatty RPCs.

Clone vs Transfer contract: For structured-clone variants, the sender sends the buffer and the receiver reads & verifies the deterministic FNV-1a windows and replies with a tiny checksum ack (avoiding an artificial second megabyte allocation). For Transfer variants, the sender transfers ownership to the receiver, asserts ab.byteLength === 0 immediately, and the receiver transfers ownership back so the exact same backing store is reused across iterations.

3. Dual-Mode Isolation (/ vs /standard/)

Browsers gate SharedArrayBuffer and sub-5 µs performance.now() precision behind Cross-Origin Isolation (Cross-Origin-Opener-Policy: same-origin + Cross-Origin-Embedder-Policy: require-corp). However, COOP: same-origin intentionally severs window.opener across cross-origin window.open() popups. PostBench therefore serves an isolated primary runner at / and a non-isolated runner at /standard/.

4. Anti-Spoofing & Trust-Tier Architecture

Any public browser benchmark runs on untrusted client hardware. No client-side script can prevent a user who controls their own browser or OS debugger from tampering with clocks. PostBench addresses this honestly through six layered server-enforced controls and transparent trust tiers:

  1. Single-Use HMAC-Signed Run Sessions: Before starting, the client calls POST /api/v1/sessions. The Worker mints a random 128-bit workSeed, records issued_at_ms, binds the server-observed User-Agent family and isolation mode, and returns an HMAC-SHA256 signature. Sessions expire after 30 minutes and are atomically marked redeemed on first submission (replay returns 409 Conflict).
  2. Server-Verified Proof-of-Execution Digests: Every iteration derives its deterministic payload seed from (workSeed, caseId, variant, iteration). Receivers inspect the transferred/cloned data and return windowed FNV-1a checksums, chained into a 16-hex proofDigest. The Worker independently recomputes expectedDeterministicCaseProof() using at most 12 KiB of scratch RAM—rejecting forged or pre-canned payloads with 422 Unprocessable Entity.
  3. Wall-Clock Envelope Verification: Submissions claiming longer client execution or summed sample work than elapsed server wall-clock time since session issuance are rejected with 422.
  4. Distribution & Physical-Consistency Invariants: Rejects invalid order statistics (min <= p50 <= p95 <= p99 <= max), inconsistent throughput calculations, and flags physical impossibilities (cross-thread RTT < 500 ns, 1 MiB worker clone faster than in-thread structuredClone, failed transfer detachment, or high timer resolution without COOP/COEP).
  5. Header Attestation, Visibility Tracking & Bot Defense: Server-side UA & Sec-CH-UA checks catch mismatched client environment claims; document.visibilitychange flags background-throttled tabs; daily-salted IP rate limits and optional Cloudflare Turnstile (siteverify) defend against automated spam.
  6. Separated Trust Tiers:
    • verified-ci — Authenticated automated headless browser runs via Bearer REPORTER_TOKEN.
    • attested-browser — Public browser runs passing session, proof, wall-clock, and physical checks.
    • local-dev — Runs submitted to a local wrangler dev Worker.
    • flagged — Runs with visibility taint, UA mismatch, or physical anomalies; stored for audit but excluded from default summary medians.

5. Round-Trip Offload Latency & Optimal Architecture Models

Sending a payload to a worker, processing it, and sending the result back is only faster than running inline on the main thread when work duration exceeds total IPC overhead—or when the goal is protecting main-thread frame responsiveness rather than raw wall-clock latency. PostBench directly decomposes five architecture models in realworld.offload-breakeven and realworld.offscreencanvas-models:

6. Origin-Agent-Cluster & Process-Separation Boundaries

Same-site cross-origin subdomains (such as postbench.dev, peer.postbench.dev with Origin-Agent-Cluster: ?0, and oac.postbench.dev with Origin-Agent-Cluster: ?1) share the same registrable site (eTLD+1 = postbench.dev). Browsers historically grouped same-site origins into a single site-keyed agent cluster (and shared renderer process) so legacy synchronous document.domain could work.

Sending Origin-Agent-Cluster: ?1 requests an origin-keyed agent cluster, disabling document.domain relaxation and allowing Chromium (Chrome 88+) and Firefox (138+) to place same-site cross-origin frames into separate processes. Conversely, hosting a peer on a completely distinct eTLD+1 (https://postmessage-bench-etld.pages.dev on pages.dev vs postbench.dev) triggers full cross-site Site Isolation. PostBench tests all of these boundaries—plus sandbox="allow-scripts" opaque origins, Worker, SharedWorker, and ServiceWorker—both by inspecting window.originAgentCluster and empirically spinning the main thread for 25 ms in realworld.process-isolation-probe to verify whether the peer responds concurrently on another OS thread.