Skip to content

Instantly share code, notes, and snippets.

@fxn
Created November 12, 2018 15:48
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 fxn/8bd3cbba9e8978d87b82a3c0c744139d to your computer and use it in GitHub Desktop.
Save fxn/8bd3cbba9e8978d87b82a3c0c744139d to your computer and use it in GitHub Desktop.
require "benchmark/ips"
Benchmark.ips do |x|
x.report("without TZ") do |n|
ENV["TZ"] = nil
i = 0
while i < n
Time.now
i += 1
end
end
x.report("with TZ") do |n|
ENV["TZ"] = ":/etc/localtime"
i = 0
while i < n
Time.now
i += 1
end
end
x.compare!
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment