develooper Front page | perl.perl5.porters | Postings from August 2001

Re: [PATCH] C Callbacks, try #3

Thread Previous | Thread Next
From:
David M. Lloyd
Date:
August 24, 2001 14:26
Subject:
Re: [PATCH] C Callbacks, try #3
Message ID:
Pine.LNX.4.33.0108241610490.11574-100000@homebody.freemm.org
On Fri, 24 Aug 2001, Paul Johnson wrote:

> > > So, this is the question: Is 35% to large a price to pay for the ability
> > > for more than one function to overload runops?
>
> Probably.  But the 7% is definitely too much.  How many modules do you
> know which would actually use it?  I know of three.  One is mine, one
> is yours, and one is Malcolms.  That's not to say that there aren't
> more modules out there using pluggable runops, or that people wouldn't
> find a good use for these callbacks if we get it right, but I just
> wanted to emphasise that any slowdown at all in the common case is
> probably unacceptable.

Yeah, like I said, I can get rid of the 7% but then the 35% goes up.
Looks like this callback scheme is just not going to work.

> Only that the main call to runops doesn't exit until the end of the
> program, so you setup your new runops function at the start, and
> that's the one you run.

Although I think technically if you called an XSUB that replaced the
runops loop, and then called a Perl sub, that sub would use your runops
loop.... I think.

> There was some discussion on #perl a few days ago about lexically
> scoped runops functions which didn't seem to come up against any
> compelling reasons why this couldn't or shouldn't be done.

That sounds neat, but how would you do it?

I may make one more attempt to do callbacks though.  What do you all think
of this idea:  First, move PERL_ASYNC_CHECK *out* of runops and *into*
ck_null for the NEXTSTATE opcode.  Then, put in the same callback stuff
that I have now.

Then people can replace runops all they want. :-)  One problem is that
current modules that replace runops (all three of them :-) put a
PERL_ASYNC_CHECK right in their loop; that would be unnecessary then.

That may even speed things up!  Although I won't put money on it till I
try it. :-)

- D

<dmlloyd@tds.net>


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