[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl
Subject: RE: Backticks as fast as XS
From: Matt Sergeant <msergeant () startechgroup ! co ! uk>
Date: 2001-09-27 8:17:51
[Download RAW message or body]
> -----Original Message-----
> From: Doug MacEachern [mailto:dougm@covalent.net]
>
> i'm guessing part of the difference in your code is due to
> fprintf having
> a pre-allocated buffer, whereas the SV's SvPVX has not been
> pre-allocated
> and gets realloc-ed each time you call sv_catpv. have a look
> at the code
> below, fprintf is faster than sv_catpvn, but if the SvPVX is
> preallocated,
> sv_catpvn becomes faster than fprintf:
>
> timethese(1_000, {
> fprintf => sub { TickTest::fprintf() },
> svcat => sub { TickTest::svcat() },
> svcat_pre => sub { TickTest::svcat_pre() },
> });
>
> Benchmark: timing 1000 iterations of fprintf, svcat, svcat_pre...
> fprintf: 9 wallclock secs ( 8.72 usr + 0.00 sys = 8.72
> CPU) @ 114.68/s (n=1000)
> svcat: 13 wallclock secs (12.82 usr + 0.00 sys = 12.82
> CPU) @ 78.00/s (n=1000)
> svcat_pre: 2 wallclock secs ( 2.75 usr + 0.00 sys = 2.75
> CPU) @ 363.64/s (n=1000)
Very interesting. I'll try that (I wish you'd been listening to clp.mod when
I posted - other perl gurus weren't much help).
Matt.
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic