Documents
benchmarks
benchmarks
Type
External
Status
Published
Created
Mar 25, 2026
Updated
Apr 4, 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: 25 prompt injection patterns
  • DLP: 47 patterns + BIP-39 seed phrase detection

Run make bench to reproduce on your hardware.

Scanner Pipeline (Scanner.Scan())#

Full 11-layer URL scanning: scheme, CRLF injection, path traversal, blocklist, DLP (pre-DNS), path entropy, subdomain entropy, SSRF (post-DNS), rate limit, URL length, data budget.

Benchmarkns/opB/opallocs/op
AllowedURL30,8333,71968
BlockedByBlocklist1,9492885
BlockedByDLP7,8082,45646
BlockedByEntropy59,5547,232115
BlockedByURLLength4,426,927139,019113
ComplexAllowedURL57,2947,426173

Response Scanning (ScanResponse())#

Pattern matching for prompt injection on fetched content. 25 patterns including 6 state/control patterns and 4 CJK-language override patterns.

Benchmarkns/opB/opallocs/op
Clean (~90B)75,7182,02129
WithInjection (~100B)41,6991,10012
LargeClean (~10KB)8,394,53143,44523
StateControlClean133,6502,43429
StateControlMatch42,8412,13817

Text DLP Scanning (ScanTextForDLP())#

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

Benchmarkns/opB/opallocs/op
Clean40,6573,55440
Match17,8992,20842

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)49700
WithPrefix (match)5531363

Cross-Request Detection#

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

Benchmarkns/opB/opallocs/op
EntropyTracker_Record109,7131,1666
EntropyTracker_RecordMultiSession14,9131,1266
FragmentBuffer_Append832001
FragmentBuffer_AppendAndScan12,666,821938,0701,244

MCP Response Scanning (mcp.ScanResponse())#

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

Benchmarkns/opB/opallocs/op
Clean76,3982,93451
Injection32,7232,15634
ExtractText (5 blocks)2,4941,08023

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

True concurrent throughput across all available goroutines.

Scanner#

Benchmarkns/opB/opallocs/op
Parallel_URLScan10,6877,917173
Parallel_DLPBlock1,4582,52746
Parallel_ResponseScan10,8972,04629
Parallel_ResponseLarge1,548,41763,05533
Parallel_Blocklist3402885
Parallel_Entropy10,1867,477115

MCP#

Benchmarkns/opB/opallocs/op
Parallel_MCPScanClean9,8682,97451
Parallel_MCPScanInjection4,4612,20434
Parallel_ExtractText5991,08023

Other#

Benchmarkns/opB/opallocs/op
ShannonEntropy2,3852,1207
MatchDomain/exact53481
MatchDomain/wildcard55481

Key Takeaways#

  • Full 11-layer scan on a typical URL: ~32 microseconds. Slightly higher than v1.5.0 (~21μs) due to expanded DLP patterns and additional scanner layers. Well under 1ms.
  • Blocked URLs short-circuit early: blocklist check is ~2μs.
  • DLP regex matching (47 patterns) with pre-filter: ~8μs. Pre-filter alone: ~497ns with zero allocations on clean text.
  • Response scanning with 25 patterns on small content: ~76μs. Large content (~10KB): ~8.4ms. State/control patterns add ~133μs on clean text. Injection detected via early exit: ~42μs.
  • MCP scanning (JSON parse + text extraction + pattern match): ~76μs clean, ~33μs injection.
  • Cross-request entropy tracking: ~110μs per record. Fragment buffer append: ~83ns (single alloc).
  • Parallel throughput scales linearly with cores (benchmarks run with rate limiting and data budget disabled to isolate scanning overhead).
  • The scanner pipeline adds ~0.032ms overhead for typical URL requests. Network latency dominates.

Hardware#

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

Running Benchmarks#

# Sequential (default)
make bench

# 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/

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

Dedicated scanner for BIP-39 mnemonic seed phrases. Uses dictionary lookup + sliding window + SHA-256 checksum validation.

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.