Sha256: 94f15ab9a41bc3dbe75e019b00467995d59f75a94b38a17c2a6e166646c69e0a

Contents?: true

Size: 116 Bytes

Versions: 27

Compression:

Stored size: 116 Bytes

Contents

def slow
  ARRAY.select { |x| (x % 10).zero? }.last
end

def fast
  ARRAY.reverse.detect { |x| (x % 10).zero? }
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
fasterer-0.2.0 spec/support/analyzer/25_select_last_vs_reverse_detect.rb
fasterer-0.1.12 spec/support/analyzer/25_select_last_vs_reverse_detect.rb
fasterer-0.1.11 spec/support/analyzer/25_select_last_vs_reverse_detect.rb
fasterer-0.1.10 spec/support/analyzer/25_select_last_vs_reverse_detect.rb
fasterer-0.1.9 spec/support/analyzer/25_select_last_vs_reverse_detect.rb
fasterer-0.1.8 spec/support/analyzer/25_select_last_vs_reverse_detect.rb
fasterer-0.1.7 spec/support/analyzer/25_select_last_vs_reverse_detect.rb