Skip to content

Instantly share code, notes, and snippets.

View MateoGreil's full-sized avatar
🥃

Matéo MateoGreil

🥃
  • 23:21 (UTC +02:00)
View GitHub Profile
@MateoGreil
MateoGreil / benchmarks.rb
Last active June 11, 2020 14:31 — forked from hopsoft/benchmarks.rb
Ruby 2.6 safe navigation `&.` vs Active Support's try
require "benchmark"
require "active_support/all"
Benchmark.bm do |x|
count = 1_000_000
label_size = 20
x.report "check for nil:".rjust(label_size) do
count.times { nil && nil.length }
end