bbae652fd0
and replace Array#second with Array#[1]. Also, Array#[] is faster than Array#first and Array#second: ``` require 'benchmark/ips' ARRAY = ['test', 2, 3, 4] Benchmark.ips do |x| x.report('Array#[0]') { ARRAY[0] } x.report('Array#first') { ARRAY.first } x.compare! end ``` Array#[0]: 9954444.8 i/s Array#first: 8092468.5 i/s - 1.23x slower ``` Benchmark.ips do |x| x.report('Array#[1]') { ARRAY[1] } x.report('Array#second') { ARRAY.second } x.compare! end ``` Array#[1]: 10052039.6 i/s Array#second: 6818468.0 i/s - 1.47x slower |
||
---|---|---|
.. | ||
ransack | ||
ransack.rb |