Permalink
Browse files

add two more somewhat common time formats to parse benchmark

  • Loading branch information...
Chuck Remes
Chuck Remes committed Mar 18, 2011
1 parent c94b07f commit 8045146115e394d915b90eef37905df3e5c9b4b1
Showing with 18 additions and 0 deletions.
  1. +18 −0 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

0 comments on commit 8045146

Please sign in to comment.