net: Improve performance of isIPv4 and isIPv6 #4691
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Corresponding PR for nodejs/node#49568
aras@aras-Lenovo-Legion-5-17ARH05H:~/workspace/proxy-addr$ bun run ./benchmark/is-ipv4.js RE (bound) x 194,995,252 ops/sec ±56.36% (25 runs sampled) RE wrapped x 218,862,836 ops/sec ±54.86% (29 runs sampled) builtIn x 26,586,761 ops/sec ±4.99% (26 runs sampled)
It has about 55% deviation. If I change minSamples to 100 then I get about
aras@aras-Lenovo-Legion-5-17ARH05H:~/workspace/proxy-addr$ bun run ./benchmark/is-ipv4.js RE (bound) x 73,035,238 ops/sec ±8.13% (107 runs sampled) RE wrapped x 74,912,245 ops/sec ±8.86% (107 runs sampled) builtIn x 18,630,794 ops/sec ±2.12% (116 runs sampled)
So maybe some benchmarking from your side would help to verify the benchmark gains?