Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

19 lines (14 sloc) 250 Bytes
require 'benchmark/ips'
require 'date'
STRING = '2018-03-21'.freeze
def fast
Date.iso8601(STRING)
end
def slow
Date.parse(STRING)
end
Benchmark.ips do |x|
x.report('Date.iso8601') { fast }
x.report('Date.parse') { slow }
x.compare!
end
You can’t perform that action at this time.