Skip to content
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

String#to_i slower than MRI when trailing garbage #2360

Closed
headius opened this issue Dec 29, 2014 · 3 comments
Closed

String#to_i slower than MRI when trailing garbage #2360

headius opened this issue Dec 29, 2014 · 3 comments

Comments

@headius
Copy link
Member

@headius headius commented Dec 29, 2014

From http://jira.codehaus.org/browse/JRUBY-5620

The rough perf numbers reported toward the end of that bug show that only the trailing-garbage case of String#to_i still runs slower than other impls, and it does so due to a wasted BigInteger along the way. I file it here because it is still an issue and probably can be improved pretty easily.

The benchmark from that bug is still valid, but may have updates in the Rubinius repository.

@headius
Copy link
Member Author

@headius headius commented Dec 29, 2014

Current numbers:

~/projects/jruby $ jruby -Xcompile.invokedynamic=true blah.rb
Calculating -------------------------------------
#to_i with an integer in a string
                        83.570k i/100ms
#to_i with a float in a string
                       139.337k i/100ms
#to_i with an empty string
                       157.295k i/100ms
#to_i with an integer and extra text
                       113.454k i/100ms
-------------------------------------------------
#to_i with an integer in a string
                         16.610M (±13.9%) i/s -     80.561M
#to_i with a float in a string
                         15.420M (±14.8%) i/s -     74.685M
#to_i with an empty string
                         37.093M (±17.9%) i/s -    176.957M
#to_i with an integer and extra text
                          7.003M (±10.6%) i/s -     34.490M

@Who828
Copy link
Contributor

@Who828 Who828 commented Jan 15, 2015

Looking into it.

@headius
Copy link
Member Author

@headius headius commented Jan 16, 2015

Fixed by #2464.

@headius headius closed this Jan 16, 2015
@headius headius added this to the JRuby 9.0.0.0-pre1 milestone Jan 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants