Skip to content

Instantly share code, notes, and snippets.

@makaroni4
Created July 7, 2014 07:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makaroni4/fc157a4caf7cd1baef0d to your computer and use it in GitHub Desktop.
Save makaroni4/fc157a4caf7cd1baef0d to your computer and use it in GitHub Desktop.
require 'benchmark/ips'
Benchmark.ips do |r|
r.report("mass") do
a, b, c, d = 1, 2, 3, 4
end
r.report("step by step") do
a = 1
b = 2
c = 3
d = 4
end
end
# Calculating -------------------------------------
# mass 66174 i/100ms
# step by step 96824 i/100ms
# -------------------------------------------------
# mass 3398229.4 (±34.4%) i/s - 13962714 in 5.006538s
# step by step 6655682.5 (±5.3%) i/s - 33210632 in 5.009689s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment