3 ms·
The trie approach seemed to be a bit plain. Tries are particularly good for storing netblocks, and see if a particular IP belongs to some block stored there. Bu
by gmuslera 2y ago
The trie approach seemed to be a bit plain. Tries are particularly good for storing netblocks, and see if a particular IP belongs to some block stored there. But is better to use binary values instead of strings, and to use patricia or radix trees as they might compress strings of bits without branches with a single node. And, anyway, postgresql already have the netblock type with efficient indexes for them.
But if that is used for individual IPs, without worrying about blocks they belong to, probably won't get big gains in that area.
- ignoramous 2y agoFor hierarchy like IP addresses, I've seen programs use specialized data structures like CritBit Tries [0] and Allotment Routing Tables [1]. [0] https://news.ycombinator.com/item?id=3015246 https://news.ycombinator.com/item?id=3015246 [1] https://github.com/openbsd/src/blob/2bd42e97200bee/sys/net/art.c https://github.com/openbsd/src/blob/2bd42e97200bee/sys/net/a...