Skip to content

Conversation

@lemire
Copy link
Member

@lemire lemire commented Dec 11, 2025

In this function, we parse the 16-bit port, only to convert it back to a string. That looks inefficient.

If we don't need the port number, we can be faster.

I asked grok to verify my code, here was the answer:

https://x.com/lemire/status/1999223408605774179?s=20

In the final step of the function, we merely validate that it is a port
number. But this does not work require parsing the port.

E.g., any port string with 3 or 4 characters (like 8001) is obviously
valid as long as it does not start with 0.
@lemire lemire requested a review from anonrig December 11, 2025 23:27
@anonrig anonrig merged commit c6e4d90 into main Dec 11, 2025
50 of 52 checks passed
@anonrig anonrig deleted the avoid_parsing branch December 11, 2025 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants