Re: [CRACK] build a better runloop
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(++$i1000){$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(++$i1000){$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.
Re: [CRACK] build a better runloop
On Tue, Sep 06, 2005 at 12:43:48PM +0200, Rafael Garcia-Suarez wrote: 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. Surely one just makes Makefile.PL parse the C source of the various pp*.c files, and grabs the code direct from there? It's not like parsing perl. :-) Here's an arguably contrived example : $ time perl -e '$i=0;while(++$i1000){$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(++$i1000){$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. about 3% faster. Hmm. Nicholas Clark
RE: [CRACK] build a better runloop
On Tue, 06 Sep 2005, Nicholas Clark wrote: On Tue, Sep 06, 2005 at 12:43:48PM +0200, Rafael Garcia-Suarez wrote: Here's an arguably contrived example : $ time perl -e '$i=0;while(++$i1000){$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(++$i1000){$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. about 3% faster. Hmm. That is just noise. You have to run the tests many times to determine the accuracy of your timings first. I find about 4% variance in the timing while running the same test over and over, so 3% difference between 2 single runs of different tests doesn't mean anything. Cheers, -Jan
Re: [CRACK] build a better runloop
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? For that matter, are the ops in pp_hot still the hot ops? Heck, could a switch oploop inline all the ops, but clustered as currently laid out in source files? Nicholas Clark
Re: [CRACK] build a better runloop
Paul Johnson wrote: On Thu, Sep 01, 2005 at 04:45:54PM +0200, Rafael Garcia-Suarez wrote: Correct me if I'm wrong, but the whole runloop is pluggable, and can be replaced by any CPAN module. Right. The main problem being, how to replace the top level runloop. I'm not sure that would be necessary, at least not to start with. The new runops would just kick in the first time a loop was needed after the module was loaded. OK, Runops::Switch 0.01 just uploaded to CPAN. From my very first tests, it's slower.
[CRACK] build a better runloop
The perl 5 runloop is simple: http://public.activestate.com/cgi-bin/perlbrowse?file=run.cblame=1 It's a tight loop, of about 8 instructions. It's also analogous to the simplest runloop in parrot Leo has just done a talk on parrot, where he showed a graph showing the relative speeds of runloops. The switch runloop is about 3-4 times faster Correct me if I'm wrong, but the whole runloop is pluggable, and can be replaced by any CPAN module. So I'm wondering if anyone wants to take this idea and see if they can create a replacement runloop module that makes existing perl faster. Nicholas Clark
Re: [CRACK] build a better runloop
Nicholas Clark wrote: Leo has just done a talk on parrot, where he showed a graph showing the relative speeds of runloops. The switch runloop is about 3-4 times faster What's a switch runloop ? What would it switch on ? PL_op-op_type ? Would it be really faster than a function pointer call ? Correct me if I'm wrong, but the whole runloop is pluggable, and can be replaced by any CPAN module. Right.
Re: [CRACK] build a better runloop
Rafael Garcia-Suarez wrote: Nicholas Clark wrote: Leo has just done a talk on parrot, where he showed a graph showing the relative speeds of runloops. The switch runloop is about 3-4 times faster What's a switch runloop ? What would it switch on ? PL_op-op_type ? Would it be really faster than a function pointer call ? This was a rhetorical question. How would we know without benchmarks :) Correct me if I'm wrong, but the whole runloop is pluggable, and can be replaced by any CPAN module. Right. The main problem being, how to replace the top level runloop.
Re: [CRACK] build a better runloop
On Thu, Sep 01, 2005 at 04:45:54PM +0200, Rafael Garcia-Suarez wrote: Correct me if I'm wrong, but the whole runloop is pluggable, and can be replaced by any CPAN module. Right. The main problem being, how to replace the top level runloop. I'm not sure that would be necessary, at least not to start with. The new runops would just kick in the first time a loop was needed after the module was loaded. -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net