summaryrefslogtreecommitdiff
path: root/BSDL
diff options
context:
space:
mode:
authorwatson1978 <watson1978@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-30 02:57:33 +0000
committerwatson1978 <watson1978@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-30 02:57:33 +0000
commitab3a40c1031ff3a0535f6bcf26de40de37dbb1db (patch)
tree93e469613a3e7207fe7b2ade2b4ea96885514220 /BSDL
parentafa0e3c9720509c1b8cc9446a6305189cc27f7c3 (diff)
Improve performance of Range#{min,max}
range.c (range_min): use OPTIMIZED_CMP() to compare the objects instead of `<=>' method dispatching for Fixnum/Float/String object inside Range object. range.c (range_max): ditto. Range#min -> 34 % up Range#max -> 44 % up [ruby-core:80713] [Bug #13443] [Fix GH-1585] ### Before Range#min 8.428M (± 1.3%) i/s - 42.141M in 5.000952s Range#max 8.157M (± 1.3%) i/s - 40.852M in 5.009297s ### After Range#min 11.269M (± 1.2%) i/s - 56.388M in 5.004611s Range#max 11.764M (± 1.3%) i/s - 58.856M in 5.003820s ### Test code require 'benchmark/ips' Benchmark.ips do |x| x.report "Range#min" do |i| i.times { (1..100).min } end x.report "Range#max" do |i| i.times { (1..100).max } end end git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58964 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'BSDL')
0 files changed, 0 insertions, 0 deletions