-
-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolv.getaddress half the speed of MRI #3241
Comments
There's a lot of variance in the numbers, particularly around the native calls. I think getaddrinfo depends on what else is going on with the system. The Ruby results are fairly stable, however. Including JRuby 1.7.21 slightly beating out master (9.0.0.0). Both are roughly half of what MRI is. |
I should note that I picked "localhost" in the benchmark because it should be in /etc/hosts. The point was to show the speed of the |
There's a great deal of allocation happening here, which likely has something to do with the overhead. Here's an allocation trace of the top items:
Most of this appears to be happening in Resolv's The The top items like |
Numbers across various versions with and without indy show that indy helps us quite a bit here: MRI 2.2: 216k |
I was recently looking at doing some custom name resolution and ended up investigating the various options within Ruby. It looks like in MRI,
IPSocket.getaddress
makes a native call togetaddrinfo
and this can be slow, leading some Rubyists to conclude that using theresolv
library is a better option. In JRuby, the native call ends up being much faster (although this may just be due caching) and theresolv
library (pure Ruby) resolves at roughly half the speed of MRI.The benchmark:
The results:
MRI:
JRuby master:
JRuby 1.7.21:
The text was updated successfully, but these errors were encountered: