develooper Front page | perl.perl5.porters | Postings from March 2008

Re: faster safe signals?

Thread Previous | Thread Next
From:
Tels
Date:
March 21, 2008 05:29
Subject:
Re: faster safe signals?
Message ID:
200803211328.27966@bloodgate.com
On Friday 21 March 2008 13:21:53 Nicholas Clark wrote:
> chromatic generated this RT ticket for parrot:
>
> On Tue, Mar 18, 2008 at 05:13:25PM -0700, Chromatic wrote:
> > # New Ticket Created by  chromatic
> > # Please include the string:  [perl #51870]
> > # in the subject line of all future correspondence about this
> > issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=51870
> > >
> >
> >
> > Currently, the concurrency and events system only handles pending
> > events at specific points, depending on runcore and opcodes.  (For
> > example, when you use the sleep opcode, when you enter a new
> > predereferenced section, or when you schedule a new event.)
> >
> > We need to figure out exactly when, how, and how often to run our
> > event loop more frequently.
>
> It made me wonder. Currently the perl 5 runloop looks like this:
>
> int
> Perl_runops_standard(pTHX)
> {
>     dVAR;
>     while ((PL_op = CALL_FPTR(PL_op->op_ppaddr)(aTHX))) {
> 	PERL_ASYNC_CHECK();
>     }
>
>     TAINT_NOT;
>     return 0;
> }
>
> where
>
> # 3 "PERL_ASYNC_CHECK expands to"
> if ((my_perl->Isig_pending)) Perl_despatch_signals(my_perl)
>
> We do the check after every op. I wondered, if we did the check
>
> 1: At every LOGOP (so every loop iteration)
> 2: At scope exit
> 3: At scope entry (or just subroutine entry, given 1 and 2)
> 4: Before sleep and select
> 5: Before and after IO operations
> 6: (maybe also) every time the regexp engine backtracks
>
> would Perl 5 be just as responsive at handling signals as it is
> currently, but also faster in the general case?

Is this check really that expensive? Or did you mean to eliminate the 
entire call to Perl_runops_standard() for other than the mentioned 
places?

Btw, does Perl_runops_standard() ever return non-zero?

All the best,

Tels

-- 
 Signed on Fri Mar 21 13:27:19 2008 with key 0x93B84C15.
 View my photo gallery: http://bloodgate.com/photos
 PGP key on http://bloodgate.com/tels.asc or per email.

 Ich bin mit der Gesamtsituation unzufrieden!


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About