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

Improved String#to_i performance for base <= 10 #2464

Merged
merged 1 commit into from
Jan 16, 2015

Conversation

Who828
Copy link
Contributor

@Who828 Who828 commented Jan 15, 2015

Addresses issue #2360 for base <= 10, both MRI and Rubyspecs test suites pass.

Running the benchmark provided without the patch

Calculating -------------------------------------
#to_i with an integer in a string
                       141.004k i/100ms
#to_i with a float in a string
                       157.672k i/100ms
#to_i with an empty string
                       172.789k i/100ms
#to_i with an integer and extra text
                       134.750k i/100ms
-------------------------------------------------
#to_i with an integer in a string
                         17.907M (±17.1%) i/s -     86.153M
#to_i with a float in a string
                         14.668M (±12.6%) i/s -     72.056M
#to_i with an empty string
                         32.909M (±24.9%) i/s -    153.437M
#to_i with an integer and extra text
                          7.122M (±11.9%) i/s -     34.900M

Running with the patch

Calculating -------------------------------------
#to_i with an integer in a string
                       124.910k i/100ms
#to_i with a float in a string
                       153.217k i/100ms
#to_i with an empty string
                       162.923k i/100ms
#to_i with an integer and extra text
                       151.294k i/100ms
-------------------------------------------------
#to_i with an integer in a string
                         18.690M (±14.5%) i/s -     90.810M
#to_i with a float in a string
                         14.590M (±14.2%) i/s -     71.093M
#to_i with an empty string
                         38.312M (±18.8%) i/s -    184.103M
#to_i with an integer and extra text
                         14.730M (±13.8%) i/s -     72.016M

headius added a commit that referenced this pull request Jan 16, 2015
Improved String#to_i performance for base <= 10
@headius headius merged commit 7402c07 into jruby:master Jan 16, 2015
@headius headius added this to the JRuby 9.0.0.0-pre1 milestone May 4, 2015
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.

2 participants