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

improve gcd performance #5364

Merged
merged 3 commits into from
Oct 14, 2018
Merged

improve gcd performance #5364

merged 3 commits into from
Oct 14, 2018

Conversation

ahorek
Copy link
Contributor

@ahorek ahorek commented Oct 12, 2018

this patch uses a variant of https://en.wikipedia.org/wiki/Binary_GCD_algorithm

ruby/ruby#1596

master

         Time#subsec      5.377M (±17.9%) i/s -     24.868M in   4.991341s
              Time#-     17.696M (± 9.1%) i/s -     86.842M in   4.982315s
          Time#round      5.162M (±10.1%) i/s -     25.510M in   4.997497s
           Time#to_f     15.985M (± 7.8%) i/s -     78.822M in   4.990285s
           Time#to_r      5.143M (± 8.4%) i/s -     25.479M in   4.993259s
          Rational#+      8.195M (± 4.6%) i/s -     40.802M in   4.995908s
          Rational#-      7.797M (± 5.2%) i/s -     38.806M in   4.999148s
          Rational#*     10.606M (± 4.5%) i/s -     52.840M in   4.994995s

patch

         Time#subsec      6.169M (±18.9%) i/s -     27.650M in   4.983793s
              Time#-     18.941M (± 9.2%) i/s -     92.775M in   4.980521s
          Time#round      5.118M (±10.9%) i/s -     25.194M in   4.993703s
           Time#to_f     17.562M (± 8.2%) i/s -     86.509M in   4.988423s
           Time#to_r      6.094M (± 7.6%) i/s -     30.234M in   4.993605s
          Rational#+      8.519M (± 4.4%) i/s -     42.450M in   4.994747s
          Rational#-      9.363M (± 4.1%) i/s -     46.672M in   4.995156s
          Rational#*     12.275M (± 4.9%) i/s -     61.094M in   4.994644s

@ahorek ahorek force-pushed the gcd_perf branch 3 times, most recently from 034d994 to 8aade59 Compare October 12, 2018 20:43
@kares kares merged commit 08cbcb3 into jruby:master Oct 14, 2018
@kares kares added this to the JRuby 9.2.1.0 milestone Oct 14, 2018
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