summaryrefslogtreecommitdiff
path: root/lib/rdoc/rdoc.gemspec
diff options
context:
space:
mode:
authorWatson <[email protected]>2019-10-09 12:25:08 +0900
committerKenta Murata <[email protected]>2019-10-09 12:25:07 +0900
commit2d001003e4b3a6c20ead09ed54b6726a7669f457 (patch)
tree91b56301a072c1c0bdaabb886d1ef43741bd3396 /lib/rdoc/rdoc.gemspec
parenta14cc07f2ffc704b73ba4b96543e2f85c3ed1921 (diff)
Improve performance of Array#sum with float elements (#1555)
The declaration of local variable in loop, it will initialize local variable for each run of the loop with clang generated code. So, it shouldn't declare the local variable in heavy loop. Array#sum with float elements will be faster around 30%. * Before user system total real 3.320000 0.010000 3.330000 ( 3.336088) * After user system total real 2.590000 0.010000 2.600000 ( 2.602399) * Test code require 'benchmark' Benchmark.bmbm do |x| ary = [] 10000.times { ary << Random.rand } x.report do 50000.times do ary.sum end end end
Diffstat (limited to 'lib/rdoc/rdoc.gemspec')
0 files changed, 0 insertions, 0 deletions