1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/benchmark/array_max_str.yml
Kenta Murata a63f520971
Optimize Array#max (#3325)
The benchmark result is below:

|                |compare-ruby|built-ruby|
|:---------------|-----------:|---------:|
|ary2.max        |     38.837M|   40.830M|
|                |           -|     1.05x|
|ary10.max       |     23.035M|   32.626M|
|                |           -|     1.42x|
|ary100.max      |      5.490M|   11.020M|
|                |           -|     2.01x|
|ary500.max      |      1.324M|    2.679M|
|                |           -|     2.02x|
|ary1000.max     |    699.167k|    1.403M|
|                |           -|     2.01x|
|ary2000.max     |    284.321k|  570.446k|
|                |           -|     2.01x|
|ary3000.max     |    282.613k|  571.683k|
|                |           -|     2.02x|
|ary5000.max     |    145.120k|  285.546k|
|                |           -|     1.97x|
|ary10000.max    |     72.102k|  142.831k|
|                |           -|     1.98x|
|ary20000.max    |     36.065k|   72.077k|
|                |           -|     2.00x|
|ary50000.max    |     14.343k|   29.139k|
|                |           -|     2.03x|
|ary100000.max   |      7.586k|   14.472k|
|                |           -|     1.91x|
|ary1000000.max  |     726.915|    1.495k|
|                |           -|     2.06x|
2020-07-18 23:45:00 +09:00

30 lines
875 B
YAML

prelude: |
ary2 = 2.times.map(&:to_s).shuffle
ary10 = 10.times.map(&:to_s).shuffle
ary100 = 100.times.map(&:to_s).shuffle
ary500 = 500.times.map(&:to_s).shuffle
ary1000 = 1000.times.map(&:to_s).shuffle
ary2000 = 2500.times.map(&:to_s).shuffle
ary3000 = 2500.times.map(&:to_s).shuffle
ary5000 = 5000.times.map(&:to_s).shuffle
ary10000 = 10000.times.map(&:to_s).shuffle
ary20000 = 20000.times.map(&:to_s).shuffle
ary50000 = 50000.times.map(&:to_s).shuffle
ary100000 = 100000.times.map(&:to_s).shuffle
benchmark:
ary2.max: ary2.max
ary10.max: ary10.max
ary100.max: ary100.max
ary500.max: ary500.max
ary1000.max: ary1000.max
ary2000.max: ary2000.max
ary3000.max: ary3000.max
ary5000.max: ary5000.max
ary10000.max: ary10000.max
ary20000.max: ary20000.max
ary50000.max: ary50000.max
ary100000.max: ary100000.max
loop_count: 10000