Commit 6a2a934
dmitrii
Replace linear IP blocklist scan with indexed trie lookup
IPList.containsAddress() scanned every stored subnet/host linearly
(O(n)). At 300k+ entries this costs ~13.7ms per lookup; isIpBlocked
runs it up to 4x per request. Switched to inet.ipaddr's built-in
DualIPv4v6Tries, giving O(bits) containment lookups (~1.2us at the
same scale). Public API and matches() semantics unchanged; all
existing IPListTest cases pass unmodified.1 parent 0c3a030 commit 6a2a934
1 file changed
Lines changed: 4 additions & 11 deletions
Lines changed: 4 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 5 | + | |
8 | 6 | | |
9 | 7 | | |
10 | | - | |
| 8 | + | |
11 | 9 | | |
12 | 10 | | |
13 | | - | |
| 11 | + | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
| |||
56 | 54 | | |
57 | 55 | | |
58 | 56 | | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
| 57 | + | |
65 | 58 | | |
66 | 59 | | |
67 | 60 | | |
| |||
0 commit comments