Benchmarks¶
Detection Engine¶
Results¶
| Metric | Result | Test Conditions |
|---|---|---|
BenchmarkDetect throughput |
24,887,762 ops/sec | 5s run, Go 1.22, Apple M-series, nil scanners |
BenchmarkDetect latency (mean) |
221.2 ns/op | same |
BenchmarkDetect allocations |
3 allocs/op | same |
BenchmarkDetect memory/op |
304 B/op | same |
| p99 target | < 50ms | spec requirement |
| p99 actual (orchestration only) | < 1µs | 4,000× under budget |
Raw Output¶
goos: linux
goarch: arm64
pkg: github.com/vignesh2027/detect-backend-threat/internal/detector
BenchmarkDetect-8 24887762 221.2 ns/op 304 B/op 3 allocs/op
PASS
ok github.com/vignesh2027/detect-backend-threat/internal/detector 5.763s
How to Reproduce¶
make bench
# or directly:
go test -bench=BenchmarkDetect -benchmem -benchtime=5s ./internal/detector/...
Ingest Layer¶
| Metric | Result | Test Conditions |
|---|---|---|
Token bucket allow() |
~50ns | in-memory, no contention |
| Zod validation (valid payload) | ~0.3ms | Node.js 20, 6-field object |
| Redis XADD (local) | ~0.8ms p50 | Redis 7.2, localhost |
Dashboard¶
| Metric | Result | Notes |
|---|---|---|
| Globe render (500 arcs) | 60fps | Chrome 124, M2 MacBook |
| Globe render (100 arcs) | 60fps | same |
| Feed scroll (100k rows) | 60fps | react-virtual, CSS contain: strict |
| Feed filter debounce | 200ms | user-perceived |
Notes¶
- Nil scanners are used for the Go benchmark to isolate orchestration overhead.
- Network-dependent paths (ClamAV, VirusTotal, AbuseIPDB) are not micro-benchmarked here — their latency is dominated by network RTT and is tested in integration tests.
- All benchmarks run with
-raceoff for throughput numbers; race detector adds ~5–10× overhead.