ReticleJS

ReticleJS Public Benchmarks

ReticleJS ships a zero-dependency, deterministic benchmark runner (scripts/benchmark.mjs) that executes directly against the production ESM bundles in dist/lib/ (core.js, enterprise.js, ai-redact.js) and verifies all subpath export sizes from package.json.

Reproducing Locally

npm run build
node scripts/benchmark.mjs                # Core/SVG/PII/bundle Markdown report to stdout
node scripts/benchmark.mjs --json         # Machine-readable JSON report
node scripts/benchmark-vision.mjs         # On-device vision & WebGPU pipeline benchmarks
node scripts/benchmark-vision.mjs --json  # Machine-readable vision benchmark JSON
npm test                                  # Includes tests/benchmarks-smoke.test.ts

Reference Run Environment

  • Recorded: 2026-11-20T06:52:32.710Z
  • Runtime: Node.js v26.13.0 (darwin/arm64)
  • Hardware: Apple M5 Max (18 cores)
  • Artifacts Measured: Production ESM bundles (dist/lib/*.js) built via npm run build
  • Runtime Dependencies: 0

Summary vs. Market Targets

Dimension Market / Engineering Target ReticleJS Measured Result Status
Headless Core Bundle (reticlejs/core) < 10 KB gzipped 7.08 KB gzip (26.24 KB raw) Pass (29% under budget)
Full Bundle (reticlejs) < 45 KB gzipped 36.00 KB gzip (156.20 KB raw) Pass (20% under budget)
1,000-Marker Single Update Latency < 16.6 ms (60 fps frame budget) 0.149 ms / update (median) Pass (111× faster than budget)
100-Marker Multi-Select Move (in 1,000-marker doc) < 16.6 ms (60 fps frame budget) 0.269 ms (median) Pass (61× faster than budget)
Undo / Redo (100-marker move) < 16.6 ms (60 fps frame budget) 0.180 ms undo / 0.174 ms redo Pass (92× faster than budget)
Headless SVG Render (1,000 markers, strict CSP) < 16.6 ms interactive / batch-ready 2.267 ms (~441k markers/sec) Pass
On-Device PII Detection Recall & Precision ≥ 95% recall & ≥ 95% precision 100.00% recall / 100.00% precision / 100.00% F1 Pass

Comparison context: Many commercial browser annotation SDKs ship monolithic bundles in the 100–500+ KB gzipped range, couple document state tightly to the DOM (requiring headless Chromium/Puppeteer for server-side SVG/image export), or require cloud round-trips for PII detection. ReticleJS's op-based headless Editor kernel (reticlejs/core, 7.08 KB gzip), pure-Node renderStateToSvgString (reticlejs/enterprise), and on-device regex + Luhn findPiiInText (reticlejs/ai-redact, 1.56 KB gzip) run identically in browsers, Web Workers, Node.js, and edge runtimes with zero runtime dependencies.


1. 1,000-Marker Editor Kernel Throughput (dist/lib/core.js)

Methodology: Constructs a 1600×1200 headless Editor, performs 1 warmup run followed by 5 measured runs, and reports the median latency (performance.now()) across:

  1. Batch-adding 1,000 mixed markers (FrameMarker, EllipseMarker, ArrowMarker, CoverMarker, HighlightMarker, TextMarker, CalloutMarker, StepMarker) in a single command.
  2. Executing 100 individual editor.updateMarkers(...) mutations inside the 1,000-marker document.
  3. Selecting 100 markers and moving them together via editor.nudgeSelected(12, 8).
  4. Undoing (editor.undo()) and redoing (editor.redo()) the 100-marker move.
Operation Median Latency Budget / Notes
Batch-add 1,000 markers 0.697 ms Single AddMarkersCommand
100 individual marker updates (total) 14.931 ms 0.1493 ms/update (< 16.6 ms 60fps budget)
100-marker multi-select move 0.269 ms < 16.6 ms 60fps budget
Undo (100-marker move) 0.180 ms < 16.6 ms 60fps budget
Redo (100-marker move) 0.174 ms < 16.6 ms 60fps budget

2. Headless SVG Batch Renderer Throughput (dist/lib/enterprise.js)

Methodology: Calls renderStateToSvgString(state, { strictCsp: true }) (zero DOM, zero inline style attributes) on deterministic 100-marker and 1,000-marker AnnotationState payloads. Performs 1 warmup render followed by 7 measured renders and reports the median time, UTF-8 output size in KB, and effective throughput.

Scene Size Median Render Time Output Size Throughput
100 markers 0.254 ms 19.96 KB 393,766 markers/s
1,000 markers 2.267 ms 202.92 KB 441,079 markers/s

3. On-Device PII Detection Recall & Precision (dist/lib/ai-redact.js)

Methodology: Runs findPiiInText over a deterministic synthetic corpus of 36 strings:

  • 26 positive PII samples across 6 categories: 4 email addresses, 4 US phone numbers (parenthesized, dashed, +1, dotted), 6 Luhn-valid credit cards (2 Visa, 2 Mastercard, 2 Amex), 4 US SSNs, 4 API keys/secrets (AWS AKIA, OpenAI-style api_key=sk-proj-..., Stripe sk_live_..., GitHub ghp_...), and 4 IPv4 addresses.
  • 10 non-PII negative decoys: order/invoice IDs, 3-part semantic versions, invalid-Luhn 16-digit tracking/serial numbers, ISO/US dates, CI build IDs, and formatted currency amounts.

A positive sample counts as a true positive (TP) only when findPiiInText returns a match with the exact expected kind; any unexpected extra match on a positive sample or any match on a negative decoy counts as a false positive (FP).

  • Confusion Matrix: TP = 26, FN = 0, TN = 10, FP = 0
  • Recall: 100.00% (target ≥ 95%)
  • Precision: 100.00% (target ≥ 95%)
  • F1 Score: 100.00%
  • Total Scan Time (36 samples): 0.971 ms
Category Detected Total Recall
email 4 4 100.0%
phone 4 4 100.0%
credit-card 6 6 100.0%
ssn 4 4 100.0%
api-key 4 4 100.0%
ip-address 4 4 100.0%

Scope note: This synthetic corpus measures deterministic pattern + checksum (isValidLuhn) accuracy on extracted text spans. End-to-end screenshot redaction accuracy in production also depends on the configured OCR provider (e.g., WebGPU Florence-2 / Tesseract / cloud OCR) and image legibility.


4. Subpath Bundle Size Snapshot (package.json exports)

Methodology: Reads every ESM import target declared in package.json exports, measures both the entry chunk gzip size and the full un-treeshaken transitive static chunk graph (zlib.gzipSync at level 9), and reports sizes in KiB (bytes / 1024).

Subpath ESM File Entry Gzip Transitive Gzip (incl. shared chunks)
. ./dist/lib/reticlejs.js 36.92 KB 50.26 KB
./core ./dist/lib/core.js 5.20 KB 12.15 KB
./pro ./dist/lib/pro.js 8.70 KB 17.44 KB
./ai-redact ./dist/lib/ai-redact.js 1.91 KB 6.94 KB
./ai-pro ./dist/lib/ai-pro.js 14.82 KB 23.01 KB
./formats ./dist/lib/formats.js 8.64 KB 10.49 KB
./wrappers ./dist/lib/wrappers.js 0.27 KB 8.26 KB
./wrappers/react ./dist/lib/wrappers/react.js 0.98 KB 0.98 KB
./wrappers/vue ./dist/lib/wrappers/vue.js 1.08 KB 1.08 KB
./wrappers/svelte ./dist/lib/wrappers/svelte.js 0.81 KB 0.81 KB
./wrappers/angular ./dist/lib/wrappers/angular.js 1.24 KB 1.24 KB
./wrappers/mobile ./dist/lib/wrappers/mobile.js 3.49 KB 5.37 KB
./enterprise ./dist/lib/enterprise.js 21.40 KB 24.91 KB
./agentic ./dist/lib/agentic.js 11.45 KB 16.38 KB
./ui ./dist/lib/ui.js 3.61 KB 3.83 KB

5. On-Device Vision & WebGPU Pipeline Benchmarks (dist/lib/ai-pro.js)

Methodology: scripts/benchmark-vision.mjs imports the production ESM bundle dist/lib/ai-pro.js directly (zero runtime dependencies) and benchmarks real CPU/WASM-path vision primitives on deterministic synthetic RGBA image buffers (640×480 and 1280×720) and a 4 MiB ONNX model shard:

  1. maskToSegmentationResult: Largest-component isolation, 8-connected Moore-Neighbor contour tracing, and Ramer-Douglas-Peucker closed-polygon simplification (simplifyEpsilon: 2.5) over synthetic foreground probability masks with stray noise pixels (2 warmups + 7 measured runs).
  2. inpaintRegion: Both bilinear-border (3 px border sample, 2 px inner feather) and diffusion (60-pass boundary-inward Laplace/harmonic relaxation) on realistic redaction/cleanup regions (120×48 in 640×480 and 240×80 in 1280×720).
  3. parseFlorence2Locations & findSemanticRedactions: Parsing 20 quantized <loc_0..999> regions at 1280×720, plus multi-target natural-language instruction parsing, phrase grounding via an injected synthetic runtime adapter, and IoU (> 0.6) deduplication (5 warmups + 25 measured runs).
  4. ModelCache SHA-256 & Cache-Hit Throughput: Web Crypto computeSha256Hex throughput and ModelCache.loadAsset cache-hit latency (verified vs. unverified) on a 4 MiB binary shard backed by InMemoryModelStore.

Hardware & Runtime Notes:

  • Recorded: 2026-11-20T18:05:46.874Z
  • Runtime: Node.js v26.13.0 (darwin/arm64), Apple M5 Max (18 cores)
  • Detected Capabilities: webgpu=false, wasm=true, wasmSimd=true, recommendedDevice=wasm
  • Live ONNX Hook: Passing --live-onnx probes for optional @huggingface/transformers without adding any runtime dependency to ReticleJS; when absent, the suite measures the pure CPU/WASM-path primitives above.
Benchmark (dist/lib/ai-pro.js) p50 Latency Mean Latency Notes
maskToSegmentationResult (640×480) 2.183 ms 2.169 ms 27 vertices, 81,448 fg px
maskToSegmentationResult (1280×720) 6.180 ms 6.037 ms 33 vertices, 244,281 fg px
inpaintRegion bilinear-border (640×480) 0.302 ms 0.296 ms 120×48 region, feather 2 px
inpaintRegion bilinear-border (1280×720) 0.794 ms 0.733 ms 240×80 region, feather 2 px
inpaintRegion harmonic diffusion (640×480) 8.362 ms 8.413 ms 120×48 region, 60 Laplace passes
inpaintRegion harmonic diffusion (1280×720) 25.443 ms 25.269 ms 240×80 region, 60 Laplace passes
parseFlorence2Locations (20 boxes, 1280×720) 0.020 ms 0.030 ms 20 regions parsed
findSemanticRedactions (3 targets + IoU dedupe) 0.008 ms 0.010 ms 4 deduped detections
computeSha256Hex (4 MiB ONNX shard) 1.856 ms 1.870 ms 2,155.2 MiB/s (Web Crypto)
ModelCache.loadAsset cache hit (4 MiB, SHA-256 verified) 1.607 ms 1.610 ms InMemoryModelStore + integrity check
ModelCache.loadAsset cache hit (4 MiB, unverified) 0.354 ms 0.360 ms InMemoryModelStore direct hit

CI Regression Guard

tests/benchmarks-smoke.test.ts runs under npm test (Vitest) to guard against regressions in every CI run:

  • Asserts ≥ 95% recall and ≥ 95% precision on the 36-sample synthetic PII corpus.
  • Asserts 1,000-marker batch-add + single move + undo completes in < 100 ms.
  • Asserts headless strict-CSP SVG rendering of 200 markers completes cleanly and produces valid <svg> markup.