Kurt George Gjerde wrote:
Hi,

Thanks for replying. I did some benchmarks today. Staggering.

Indeed.


[...]
I then added localtime() to STDERR to see if that could slow it down a bit:

timethese(2000, {
'log_error' => sub { $r->log_error("benchmarking log_error") },
'STDERR' => sub { print STDERR '['.scalar(localtime())."] [error] benchmarking log_error\n" },
});


Result:

Benchmark: timing 2000 iterations of STDERR, log_error...
STDERR: 0 wallclock secs ( 0.03 usr + 0.00 sys = 0.03 CPU) @ 64516.13/s (n=2000)
(warning: too few iterations for a reliable count)
log_error: 40 wallclock secs ( 0.05 usr + 0.50 sys = 0.55 CPU) @ 3663.00/s (n=2000)


Still below 1 second but the rate has dropped to the half.

The difference between the two approaches is not big under linux. I had to raise the number of tests to 100000 to get useful results:


# Benchmark: timing 100000 iterations of STDERR, log_error...
# STDERR: 6 wallclock secs ( 2.80 usr + 1.18 sys = 3.98 CPU) @ 25125.63/s (n=100000)
# log_error: 6 wallclock secs ( 1.48 usr + 1.14 sys = 2.62 CPU) @ 38167.94/s (n=100000)



So it must be a slow implementation of apr logging functions on windows. You may want to mention this to the httpd/apr win32 developers.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to