Skip to content

Instantly share code, notes, and snippets.

@jonas-schulze
Created March 15, 2018 11: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 jonas-schulze/19f4e65fe1fa48fc4354cab7e3458f5d to your computer and use it in GitHub Desktop.
Save jonas-schulze/19f4e65fe1fa48fc4354cab7e3458f5d to your computer and use it in GitHub Desktop.
Ruby Performance Tricks -- 6 Years Later -- Trick 6
require 'benchmark'
N = 10_000_000
puts RUBY_DESCRIPTION
Benchmark.bm(15) do |x|
x.report('parallel') do
N.times do
a, b = 10, 20
end
end
x.report('consequentially') do |x|
N.times do
a = 10
b = 20
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment