Skip to content

Dispatcher queue does quadratic copying; multi-million-line wordlists spend minutes in bookkeeping #49

Closed

Description

@TMHSDigital

Why it matters

Large wordlists (SecLists/Assetnote merges, 1M-10M lines) are the normal input for serious brute-forcing. The dispatcher's queue compaction makes scan overhead grow quadratically with wordlist size, independent of network speed.

Evidence

internal/scan/runner.go:401-403:

case head >= queueCompactEvery:
    queue = append([]job(nil), queue[head:]...)
    head = 0

Once head >= 1024, this reallocates and copies the entire remaining queue every 1024 dispatches, which is about N²/2048 job copies in total.

Simulate mode, HitRate 0, 50 workers:

entries time
100k 0.37s
500k 1.86s
1M 5.8s
2M 19.6s

A CPU profile at 2M shows the dispatcher at about 27% cumulative CPU, with most of the remaining time in GC, memmove and memclr; actual job processing is about 0.4s.

Related memory cost: every entry+"."+domain string is built up front, and visited holds another entry for each one, on top of cfg.Entries.

Suggested approach

  • Compact only when head >= len(queue)/2, or replace the queue with a ring buffer or chunked deque.
  • Serve depth-1 jobs lazily by index into cfg.Entries instead of materialising them; only queue recursive children.
  • Add BenchmarkRun1M in simulate mode to guard against regressions.

Done when

Dispatcher overhead is linear: 2M entries in simulate mode takes about 2x the 1M time, and a benchmark is in CI or the Makefile.

Activity

  1. added
    bug
    priority: high
    performance
    area: scan
    on Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: scanbugperformancepriority: high

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions