Nicholas Clark wrote:
> On Fri, Sep 02, 2005 at 12:07:21PM +0200, Rafael Garcia-Suarez wrote:
> 
> > OK, Runops::Switch 0.01 just uploaded to CPAN.
> > 
> > From my very first tests, it's slower.
> 
> To make it faster, would it need to inline the hot ops?

OK, 0.02 uploaded to play with :

0.02 - 06 Sep 2005
    Inline some small hot ops, taking code from current bleadperl :
    null, stub, scalar, pushmark, const, gv, pushre, stringify, and, or,
    cond_expr, nextstate, unstack, setstate

Compiles with 5.8.7.

Of course, this raises portability problems among different versions of
perl, and I didn't took time to put a ppport.h in there.

Here's an arguably contrived example :

$ time perl -e '$i=0;while(++$i<10000000){$i=~/00/ and $y = 0}'
4.20user 0.00system 0:04.21elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+413minor)pagefaults 0swaps
$ time perl -Mblib -MRunops::Switch -e '$i=0;while(++$i<10000000){$i=~/00/ and 
$y = 0}'
4.07user 0.00system 0:04.08elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+640minor)pagefaults 0swaps

Ooh, it's faster. I don't expect it to be always faster, though.

Reply via email to