speed up Integer#multiple_of? #12858

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
3 participants
Contributor

kuldeepaggarwal commented Nov 11, 2013

ruby 2.0.0p247
Rehearsal ---------------------------------------
old 1.300000 0.010000 1.310000 ( 1.304970)
new 1.110000 0.000000 1.110000 ( 1.110088)
------------------------------ total: 2.420000sec

      user     system      total        real

old 1.300000 0.000000 1.300000 ( 1.297435)
new 1.110000 0.000000 1.110000 ( 1.110639)

speed up Integer#multiple_of?
ruby 2.0.0p247
Rehearsal ---------------------------------------
old   1.300000   0.010000   1.310000 (  1.304970)
new   1.110000   0.000000   1.110000 (  1.110088)
------------------------------ total: 2.420000sec

          user     system      total        real
old   1.300000   0.000000   1.300000 (  1.297435)
new   1.110000   0.000000   1.110000 (  1.110639)
Owner

rafaelfranca commented Nov 11, 2013

What is the content of the benchmark script? Also I don't think this speedup matters since it make the code less intuitive.

Contributor

kuldeepaggarwal commented Nov 11, 2013

Benchmark.bmbm { |p|
p.report("new") do
5000000.times{ 10.multiple_of?(0) }
end
};

Owner

rafaelfranca commented Nov 11, 2013

If in 5_000_000 the difference was so little so I don't think we need to optimize this.

Owner

fxn commented Nov 11, 2013

Agreed.

Contributor

kuldeepaggarwal commented Nov 11, 2013

Hey @rafaelfranca , i have a doubt, actually i changed just author name, but now when my commits have merged then my old commits are showing under my previous Author Name, so is there any way to combine them under my Latest Author name?

Owner

rafaelfranca commented Nov 11, 2013

@kuldeepaggarwal yes, you need to add a mapping here. https://github.com/fxn/rails-contributors/blob/master/app/models/names_manager.rb#L1027

Please send a PR in that repository

Contributor

kuldeepaggarwal commented Nov 11, 2013

@rafaelfranca Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment