Parsing IPv6 Addresses Crazily Fast with AVX-512
A new method for parsing IPv6 addresses using AVX-512 instructions has been developed, significantly improving speed. This approach processes over 70 million addresses per second, making it approximately 12 times faster than the standard inet_pton function. The technique leverages data parallelism to enhance performance while reducing the number of instructions executed.
- ▪IPv6 addresses are 128-bit and can be represented in a compressed format.
- ▪The AVX-512 routine outperforms inet_pton by parsing addresses at a rate of over 70 million per second.
- ▪This new method uses eight times fewer instructions than the traditional approach.
Opening excerpt (first ~120 words) tap to expand
Parsing IPv6 Addresses Crazily Fast with AVX-512 Every machine connected to the Internet has an address called an IP address. Originally, these addresses were 32-bit integers (IPv4), giving a theoretical maximum of about four billion distinct addresses. We are all familiar with these addresses (e.g., 192.168.0.0). There was a big fuss about how we would run out of addresses. It never happened because we don’t actually need every device to have its own unique address. Your home router needs an address, but every device in your home does not need a worldwide unique address. Nevertheless, the range was extended to cover 128 bits (IPv6). An IPv6 address is conventionally written as eight groups of four hexadecimal digits separated by colons.
…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Daniel Lemire's blog.