Get the latest tech news

Fastest way to get IPv4 address from string


I have the following code which is about 7 times faster than inet_addr . I was wondering if there is a way to improve this to make it even faster or if a faster alternative exists. This code requi...

Since we are speaking about maximizing throughput of IP address parsing, I suggest using a vectorized solution. Note that random trashy bytes after the end of the string may in principle cause increased memory footprint in the lookup table. EDIT: you can find a version modified by @IwillnotexistIdonotexist in comments, which uses lookup table of only 4Kb size (it is a bit slower, though).

Get the Android app

Or read this on Hacker News

Read more on:

Photo of string

string

Photo of Fastest way

Fastest way

Photo of address

address

Related news:

News photo

Ars Technica used in malware campaign with never-before-seen obfuscation — Buried in URL was a string of characters that appeared to be random, but were actually a payload

News photo

Japan Makes First Moon Landing With Precision Space Probe

News photo

Europol arrest hackers allegedly behind string of ransomware attacks