Skip to content

Adds radix_lookup.py IP lookups.#8

Open
yanniksuess wants to merge 1 commit intorezmoss:mainfrom
yanniksuess:radix-lookup
Open

Adds radix_lookup.py IP lookups.#8
yanniksuess wants to merge 1 commit intorezmoss:mainfrom
yanniksuess:radix-lookup

Conversation

@yanniksuess
Copy link
Copy Markdown

Summary

  • Adds radix_lookup.py using a radix tree (pysubnettree) for O(1) IP lookups
  • Benchmarked at 2.3M lookups/sec (IPv4) and 1.6M/sec (IPv6) vs ~28/sec with linear scan
  • Same interface and output format as lookup.py — drop-in alternative for large-scale use
  • Adds requirements.txt with pysubnettree dependency
  • Updates README with Fast Lookup section

Benchmark results

IPs Linear (lookup.py) Radix (radix_lookup.py) Speedup
10,000 433s 0.006s 67,274x
1,000,000 IPv4 ~9.7h (projected) 0.42s ~2.3M/sec
1,000,000 IPv6 0.60s ~1.6M/sec

Both tools produce identical results — verified with 10k random IPs (434 matches each).

Benchmarked at 2.3M lookups/sec (IPv4) and 1.6M/sec (IPv6)
vs ~28/sec with the linear scan in lookup.py.

Same interface and output format.
Adds requirements.txt and updates README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant