benchmarks
Type
External
Status
Published
Created
Mar 25, 2026
Updated
Jul 19, 2026
Updated by
Dosu Bot

Pipelock Benchmarks#

Raw benchmark data from Go's testing framework. For interpretation and deployment sizing, see performance.md.

Methodology#

Benchmarks measure the scanner pipeline only, not network I/O. This isolates pipelock's overhead from external fetch latency.

Configuration (balanced defaults):

  • SSRF protection disabled (no DNS lookups in benchmarks)
  • Rate limiting disabled (no time-dependent state)
  • Response scanning: 32 prompt injection patterns
  • DLP: 65 patterns + BIP-39 seed phrase detection

Run make bench to reproduce on your hardware. Numbers below are the median of three runs on the hardware listed at the bottom (v3.1.0).

Scanner Pipeline (Scanner.Scan())#

URL scanning with DNS-based SSRF, rate limiting, and data budget checks disabled: scheme, CRLF injection, path traversal, blocklist, DLP (pre-DNS), path entropy, subdomain entropy, and URL length. DNS resolution, the post-DNS SSRF layer, rate limiting, and data budget enforcement are excluded from these measurements.

Benchmarkns/opB/opallocs/op
AllowedURL38,6565,72299
BlockedByBlocklist1,8943206
BlockedByDLP7,2044,272109
BlockedByEntropy59,43211,589194
BlockedByURLLength142643
ComplexAllowedURL107,63124,723600

Response Scanning (ScanResponse())#

Pattern matching for prompt injection on fetched content, across the multi-pass normalization cascade (normalized, invisible-spaced, leetspeak, optional-whitespace, vowel-fold, decode).

Benchmarkns/opB/opallocs/op
Clean (~90B)387,4506,72768
WithInjection (~100B)71,9882,10616
LargeClean (~10KB)46,291,110118,85064
StateControlClean667,2717,96468
StateControlMatch537,8028,12172

Text DLP Scanning (ScanTextForDLP())#

DLP pattern matching on arbitrary text (MCP arguments, request bodies). 65 patterns with Aho-Corasick pre-filter.

Benchmarkns/opB/opallocs/op
Clean82,4255,80580
Match85,47413,866237

DLP Pre-Filter#

Aho-Corasick prefix automaton. Short-circuits clean text before regex evaluation. Zero allocations on miss.

Benchmarkns/opB/opallocs/op
CleanText (no match)67100
WithPrefix (match)6531683

Cross-Request Detection#

Entropy budget tracking and fragment buffer for detecting secrets split across multiple requests.

Benchmarkns/opB/opallocs/op
EntropyTracker_Record113,7191,1576
EntropyTracker_RecordMultiSession18,0181,1296
FragmentBuffer_Append762001
FragmentBuffer_AppendAndScan11,984,4181,420,138686

MCP Response Scanning (mcp.ScanResponse())#

JSON-RPC 2.0 response parsing + text extraction + prompt injection scanning.

Benchmarkns/opB/opallocs/op
Clean351,47512,283186
Injection61,0476,145130
ExtractText (5 blocks)5,4355,20873

Parallel Throughput (b.RunParallel, GOMAXPROCS=16)#

True concurrent throughput across all available goroutines.

Scanner#

Benchmarkns/opB/opallocs/op
Parallel_URLScan56,92924,863600
Parallel_DLPBlock3,8984,276109
Parallel_ResponseScan186,9198,27968
Parallel_ResponseLarge22,611,580370,125134
Parallel_Blocklist9503206
Parallel_Entropy28,34811,668194

MCP#

Benchmarkns/opB/opallocs/op
Parallel_MCPScanClean181,21914,483186
Parallel_MCPScanInjection33,0457,107130
Parallel_ExtractText3,3635,20873

Other#

Benchmarkns/opB/opallocs/op
ShannonEntropy2,2012,1207
MatchDomain/exact49481
MatchDomain/wildcard52481

Key Takeaways#

  • Typical URL scan with DNS-based SSRF, rate limiting, and data budget checks disabled: ~39 microseconds (measured on v3.1.0). Well under 1ms; network latency dominates real requests.
  • Blocked URLs short-circuit early: the blocklist check is ~2μs, and an over-length URL is rejected in ~142ns before any expensive layer runs.
  • DLP regex matching (65 patterns) with pre-filter: ~7μs. Pre-filter alone: ~671ns with zero allocations on clean text.
  • Response scanning runs the full multi-pass normalization cascade: ~387μs on small clean content, ~72μs when injection is detected via early exit. State/control patterns add cost on clean text (~667μs). Large content (~10KB) is the heavy case at ~46ms; a scanner + benchmark performance audit is planned for a future release.
  • MCP scanning (JSON parse + text extraction + pattern match): ~351μs clean, ~61μs injection.
  • Cross-request entropy tracking: ~114μs per record. Fragment buffer append: ~76ns (single alloc).
  • Parallel benchmark throughput was measured at GOMAXPROCS=16 (benchmarks run with rate limiting and data budget disabled to isolate scanning overhead; per-op time rises under SMT contention on this 8-core/16-thread part).

Hardware#

AMD Ryzen 7 7800X3D (8 cores / 16 threads) / Go 1.25 / Linux 6.x / Fedora 43

Running Benchmarks#

# Sequential (default)
make bench

# Advisory scanner/MCP regression guard against bench/scanner-baseline.txt
make bench-regression

# Regenerate the moving local baseline after an intentional benchmark refresh
make bench-baseline

# Parallel scaling
go test -bench=BenchmarkParallel -benchtime=3s -cpu=1,2,4,8,16 ./internal/scanner/
go test -bench=BenchmarkParallel -benchtime=3s -cpu=1,4,8,16 ./internal/mcp/

# Concurrent throughput scaling test (1-64 goroutines, ~28s)
PIPELOCK_BENCH_SCALING=1 go test -v -run=TestConcurrentThroughputScaling ./internal/scanner/

# Seed phrase detection
go test -bench=BenchmarkSeed -benchmem ./internal/seedprotect/

make bench-regression runs the scanner and MCP benchmarks with fixed -count
and -benchtime, then compares the fastest (min) ns/op per benchmark against
bench/scanner-baseline.txt straight from the raw go test output, and fails
when any benchmark regresses beyond BENCH_REGRESSION_THRESHOLD_PCT (default
50). The pass/fail decision does not depend on benchstat; if benchstat is
installed it is used only to print a readable summary. Set BENCH_BASELINE to
compare against a different baseline. This guard is an advisory maintainer/pre-tag
check, not a machine-independent CI gate, so it is intentionally not wired into
blocking CI.

BIP-39 Seed Phrase Detection (seedprotect.Detect())#

Dedicated scanner for BIP-39 mnemonic seed phrases. Uses dictionary lookup + sliding window + SHA-256 checksum validation. Run go test -bench=BenchmarkSeed -benchmem ./internal/seedprotect/ for current numbers on your hardware.

Benchmarkns/opB/opallocs/opDescription
SeedDetect_CleanText2,2291,80320Short text with no BIP-39 words (fast bail)
SeedDetect_ValidPhrase2,9261,7561812-word valid mnemonic (full pipeline + checksum)
SeedDetect_LongText2,853,140858,4476,3681000-word text, all BIP-39 words (worst case)
SeedChecksum13600Checksum validation in isolation

Clean text bails in ~2μs. Valid phrase detection including checksum takes ~3μs. The 1000-word worst case (all BIP-39 words) is a pathological input that doesn't occur in real traffic. Checksum validation is 136ns with zero allocations.