Repository navigation
Description
Summary
The wordlist is re-normalised from raw lines for every target in a -dL run, with a regex match per label and a strings.Split per entry. On a 1M-line list that is about 0.8 s and 216 MB of garbage per target before any lookup starts.
Where
internal/wordlist/reader.go:16, 39-51(labelRegex.MatchStringper label,strings.Splitper entry)main.go:698(probeBuild),main.go:707(resumeBuild),main.go:872(Buildagain per target in the-dLloop),main.go:693(raw[]stringretained for the run)
Details
| Measurement | Result |
|---|---|
Build on 1M lines |
774 ms, 216 MB allocated, 1.0M allocs per call |
-simulate -w w1m.txt -max-queries 1, 1 target |
2.24 s |
same with -dL of 5 targets |
8.02 s (about 1.45 s per extra target) |
| Peak RSS loading a 13 MB list | 214 to 258 MB |
The only per-target dependency is the 253-character FQDN length check; everything else is target-independent.
Impact
A -dL of 100 domains with a 1M list spends roughly 2.5 minutes and churns about 20 GB of allocations before scanning.
Steps to reproduce
go test -bench Build1M -benchmem on wordlist.Build with a 1M-line fixture; time -max-queries 1 with -dL of 1 vs 5 domains.
Suggested fix
Normalise once: a hand-rolled label validator instead of the regex, scan for dots instead of strings.Split, keep the normalised entries, and per target filter only on len(entry)+1+len(domain) > 253 (or compute maxEntryLen once and skip the pass when it cannot exceed the limit). Drop the probe Build at main.go:698 in favour of the first target's result and release the raw lines after normalising.
Acceptance criteria
- Per-target cost for a 1M list under 50 ms after the first target
-
Buildallocations reduced by at least 5x on the benchmark - Existing wordlist validation tests unchanged
Getting started
- Relevant files:
internal/wordlist/reader.go,main.go,main_wordlist.go - How to run tests:
go test ./internal/wordlist/ .
Filed by repo-audit/full-audit at 3139c44. Severity: medium. Effort: M. audit-key: performance|internal/wordlist/reader.go|Build
Activity
TMHSDigital commentedon Nov 9, 2026
Fixed in 3e2cb2b:
wordlist.Preparenormalizes once (hand-rolled label check, no regexp or Split) andPrepared.Forapplies only the per-target length limit. On 1M lines,Buildwent from 813 ms / 1.0M allocs to 524 ms / 8.3k allocs, and each further-dLtarget costs 0.5 ms with 0 allocs. Verified with a randomized equivalence test against the old regexp algorithm, the existing wordlist tests,go test -race ./...and golangci-lint.refactor: unify result and event types across scan, output, TUI (#162)
docs(architecture): describe the engine as it is on main (#228)
docs(changelog): unreleased fixes since v0.10.0 and version links (#231)
perf(wordlist): normalize the wordlist once per run, not per target (T…