On Friday 28 May 2004 01:36 pm, Stas Bekman wrote:

> >>http://perl.apache.org/docs/2.0/api/APR/Date.html

> > Are these parsers any faster than the perl module ones? (Ie. any reason
> > for using these over Date::Time or similar?)
>
> They are written in C, so if Date::Time is not, APR::Date is probably
> faster. But don't take my word for granted as I didn't benchmark -- run
> Benchmark.pm and post your findings to the list for the rest to know.
> Thanks!

I finally got chance to do this, here's the results from parsing 
'Sun, 06 Nov 1994 08:49:37 GMT', with 10000 iterations using 
Benchmark::timethis. There's actually quite a number of different date 
parsing modules on cpan, each of which does something slightly different.


Date::Parse::str2time  
        3 wallclock secs ( 3.58 usr +  0.01 sys =  3.59 CPU) @ 2785.52/s 

Time::ParseDate::parsedate
        4 wallclock secs ( 3.35 usr +  0.01 sys =  3.36 CPU) @ 2976.19/s

Date::Manip::ParseDate
        63 wallclock secs (63.12 usr  0.02 sys +  0.01 cusr  0.01 csys = 63.16 CPU) @ 
158.38/s

APR::Date::parse_rfc:  
        0 wallclock secs ( 0.04 usr +  0.00 sys =  0.04 CPU) @ 250000.00/s

APR::Date::parse_http:  
        0 wallclock secs ( 0.03 usr +  0.00 sys =  0.03 CPU) @ 333333.33/s


So, assuming the date you have is either HTTP-compliant or RFC822-compliant, 
then the APR::Date functions are orders of magnitude faster.

Hopefully this is of use to someone.


-- 
There's only one corner of the universe you can be certain of improving,
and that's your own self.
- Aldous Huxley

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Reply via email to