Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add two more somewhat common time formats to parse benchmark

  • Loading branch information...
commit 8045146115e394d915b90eef37905df3e5c9b4b1 1 parent c94b07f
Chuck Remes authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 benchmark/core/time/bench_parse.rb
View
18 benchmark/core/time/bench_parse.rb
@@ -18,6 +18,8 @@
rfc2822_date_time_cst = "08 Mar 11 10:09:08 CST"
format_c = "Fri Jan 02 08:10:00 -0600 2004"
+ format_d = "Fri, 02 Jan 2004 08:10:00 -0600"
+ format_e = "2011/03/08 10:09:08 -0600"
x.report "parse '#{iso_8601_date_only_locale_neutral}'" do |times|
@@ -108,4 +110,20 @@
end
end
+ x.report "parse '#{format_d}'" do |times|
+ i = 0
+ while i < times
+ Time.parse(format_d)
+ i += 1
+ end
+ end
+
+ x.report "parse '#{format_e}'" do |times|
+ i = 0
+ while i < times
+ Time.parse(format_e)
+ i += 1
+ end
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.