Skip to content

Instantly share code, notes, and snippets.

@headius
Created January 10, 2012 03:13
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 headius/1586648 to your computer and use it in GitHub Desktop.
Save headius/1586648 to your computer and use it in GitHub Desktop.
require 'benchmark'
require 'time'
string = "2010-11-10 23:00:00 UTC"
n = 1_000_000
Benchmark.bmbm do |b|
# b.report 'Time.parse' do
# n.times do
# Time.parse(string)
# end
# end
b.report 'Time.strptime' do
format = '%Y-%m-%d %H:%M:%S %z'
n.times do
Time.strptime(string, format)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment