5 ms·
The dataset is 1.2 million entries, which looks big, but really is not that much. If this is uncompressed IPv4 addresses, it's just 4.8 MB; and with some triva
by theamk 2y ago
The dataset is 1.2 million entries, which looks big, but really is not that much.
If this is uncompressed IPv4 addresses, it's just 4.8 MB; and with some trival compression (like a 2-level trie), it could be about 2x smaller. Even if it's uncompressed IPv6, that's still just 32 megabytes.
Does Ruby support mmap? If yes, I'd suggest direct IP list. Lots of fun to write, big speedup over sqlite, and zero startup time.