in reply to Fast date parsing

In case anyone's curious as to the actual benchmark results...

Time::Local is a 4400% speedup. I was expecting a lot, but that's a lot more than I expected.

It looks like regexp based timelocal_nocheck() is 3% faster than the unpack() version -- that could be because of my unnecessary assignment. Neat. I like that Benchmark module.

sub datemanip { &UnixDate(&ParseDate($date), '%s') } sub r_timelocal { $date =~ m/^([A-Z][a-z]{2}) (\d{2}) (\d{2}):(\d{2 +}):(\d{2})$/; timelocal($5, $4, $3, $2, $month{$1}, 2005) } sub r_timelocal_nc { $date =~ m/^([A-Z][a-z]{2}) (\d{2}) (\d{2}):(\d{2 +}):(\d{2})$/; timelocal_nocheck($5, $4, $3, $2, $month{$1}, 20 sub u_timelocal_nc { my @a = reverse unpack('A3xA2xA2xA2xA2', $date); +$a[$#a] = $month{$a[$#a]}; timelocal_nocheck(@a, 2005); } Date::Manip: 768 wallclock secs (636.70 usr + 3.83 sys = 640.53 CPU) +@ 156.12/s (n=100000) r timelocal: 20 wallclock secs (14.86 usr + 0.10 sys = 14.96 CPU) @ 6 +684.49/s (n=100000) r timelocal nc: 16 wallclock secs (14.40 usr + 0.06 sys = 14.46 CPU) +@ 6915.63/s (n=100000) u timelocal nc: 20 wallclock secs (14.80 usr + 0.08 sys = 14.88 CPU) +@ 6720.43/s (n=100000) Rate Date::Manip r timelocal u timelocal nc r ti +melocal nc Date::Manip 156/s -- -98% -98% + -98% r timelocal 6684/s 4182% -- -1% + -3% u timelocal nc 6720/s 4205% 1% -- + -3% r timelocal nc 6916/s 4330% 3% 3% + --