Skip to content

feat: reproducible benchmark suite; align published perf claims with measured results#164

Merged
sidmohan0 merged 2 commits into
devfrom
bench/reproducible-benchmarks
Jul 6, 2026
Merged

feat: reproducible benchmark suite; align published perf claims with measured results#164
sidmohan0 merged 2 commits into
devfrom
bench/reproducible-benchmarks

Conversation

@sidmohan0

Copy link
Copy Markdown
Contributor

Summary

Every performance number DataFog publishes should be reproducible by a skeptic with one command. This PR adds that command and aligns the published copy with what it actually measures.

New: benchmarks/

  • python benchmarks/run.py — five suites: core (scan/redact throughput), guardrail (DataFogGuardrail via LiteLLM, in-process), hook (datafog-hook as a real subprocess incl. Python startup, exactly as Claude Code invokes it), spacy and presidio comparisons on identical payloads and entity types.
  • Pinned payloads with manifest.json-recorded detection counts, verified before timing — the suite fails loudly rather than benchmark an engine that stopped detecting. All PII values are standard synthetic test data.
  • Comparison suites pin en_core_web_sm (smallest model, favorable to spaCy/Presidio) and exclude their setup cost, so measured ratios are defensible lower bounds.
  • Stdlib timeit only for the core/hook path; guardrail + comparison deps live in benchmarks/requirements.txt, out of the package. No __init__.py, nothing ships in the wheel.

Claim changes backed by the measurements (Apple M5 Pro reference numbers in benchmarks/README.md)

Claim Verdict Now says
Guardrail "~31µs per request" per-scan, not per-request (full request ~120–220µs) "~40µs per message scanned; a request clears the guardrail in well under a millisecond"
Hook "~70ms incl. startup" reproduced (69–89ms median) "~70–90ms"
PyPI "190x performance advantage" not reproduced (103–170x vs Presidio, 114–140x vs spaCy) "100x+ faster than NER-based detection"

Roadmap consolidation

  • docs/roadmap.rst refreshed to reality: 4.1–4.7.0 marked shipped with actual release content, 4.7.x precision-patch focus, v5.0.0 themes from the public roadmap text.
  • Root ROADMAP.md added as a two-line pointer to docs/roadmap.rst (single source of truth). Removed the case-insensitive Roadmap.md gitignore entry that swallowed it. Supersedes docs: add public v5.0.0 roadmap #153.

Test plan

  • Full run of all five suites on macOS (results in benchmarks/README.md)
  • --quick, --suite subset, unknown-suite error path, --json export exercised
  • Graceful skip verified for missing optional deps (install hint printed)
  • pytest green — 646 passed; only pre-existing en_core_web_lg-missing failures (unrelated, env-only)
  • black/isort/flake8 clean on benchmarks/
  • Sphinx docs build exits 0, roadmap page renders
  • CI green on this PR

…ith measured results

Every performance number DataFog publishes is now reproducible with one
command: python benchmarks/run.py. Suites: core scan/redact throughput,
LiteLLM guardrail (DataFogGuardrail), Claude Code hook (datafog-hook
subprocess incl. startup), plus clearly-labeled comparisons against
presidio-analyzer and spaCy NER on identical pinned payloads
(manifest-verified detection counts before timing; en_core_web_sm pinned,
favorable to comparison targets, so ratios are lower bounds).

Claims aligned with measured results (Apple M5 Pro reference numbers in
benchmarks/README.md):
- LiteLLM guardrail: '~31µs per request' was really per-scan; reworded to
  ~40µs per message scanned (full 2-msg request: ~120µs clean / ~220µs
  with redaction+litellm logging).
- Claude Code hook: ~70ms confirmed (69-89ms median incl. startup);
  reworded to ~70-90ms.
- '190x performance advantage' tagline not reproducible (measured
  103-170x vs Presidio, 114-140x vs spaCy); reworded to '100x+ faster
  than NER-based detection' in setup.py, setup_lean.py, __init__
  docstrings, AGENTS.md, docs/roadmap.rst.

Also refresh docs/roadmap.rst to current state (4.1-4.7.0 shipped, 4.7.x
precision patches, v5.0.0 themes from the public roadmap) and add a
ROADMAP.md stub pointing at it as the single source of truth (removing
the stale case-insensitive Roadmap.md gitignore entry that swallowed it).

Benchmark deps stay out of the core package (benchmarks/requirements.txt);
benchmarks/ has no __init__.py so nothing ships in the wheel.
@sidmohan0 sidmohan0 mentioned this pull request Jul 6, 2026
1 task
@sidmohan0 sidmohan0 merged commit d476bec into dev Jul 6, 2026
26 checks passed
@sidmohan0 sidmohan0 mentioned this pull request Jul 6, 2026
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