Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View benchmark_dish.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
require "benchmark"
require "benchmark/ips"
require "dish"
 
hash = {
title: "My Title",
authors: [
{ id: 1, name: "Mike Anderson" },
{ id: 2, name: "Well D." }
],
active: false
}
 
dish = Dish(hash)
 
Benchmark.ips do |x|
x.report("hash") { hash[:title] }
x.report("dish") { dish.title }
end
View benchmark_dish.rb
1 2 3 4 5 6 7
$ ruby dish.rb
Calculating -------------------------------------
hash 69367 i/100ms
dish 24472 i/100ms
-------------------------------------------------
hash 3948215.8 (±23.7%) i/s - 16023777 in 4.999657s
dish 538116.3 (±12.0%) i/s - 2642976 in 5.006639s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.