develooper Front page | perl.perl5.porters | Postings from February 2013

Re: PL_sv_objcount

Thread Previous | Thread Next
Andy Dougherty
February 28, 2013 16:33
Re: PL_sv_objcount
Message ID:
On Thu, 28 Feb 2013, Nicholas Clark wrote:

> On Thu, Feb 28, 2013 at 09:48:37AM -0500, bulk88 wrote:
> > Shutdown time is part of startup time. So it does affect one liners. 
> > Running sv_clean_objs when PL_sv_objcount == 0, takes 1/10th to 1/100th 
> > of a ms, or 200,000,000 to 20,000,000 instructions (2 GHZ cpu, and 
> > instruction count is 100% useless, but it makes a point about numbers). 

> > <sarcasm> I already know everyone here uses mod_perl, so why care about 
> > one liners? they aren't real Perl users. Real Perl users lease another 
> > blade when they need more performance or dont use Perl.</sarcasm>

That's neither true nor particularly helpful here.

> You are arguing in favour of optimising about 30 *micro*-seconds from the
> runtime of *trivial* one-liners (ie don't use Exporter or Config)

I actually have a modest amount of non-trivial code that doesn't end up
setting PL_sv_objcount.  This code often runs on 10-year-old hardware,
and gets called thousands of times in tight loops running various
batch processes.  And still I have a hard time getting worried about a
potential 30 microsecond slowdown.

To be balanced, I also suspect that the speed gain for long-running
complex processes will be rather small and difficult to measure.

> In the long game, maintainability and better algorithms win.

This, I think, is the most relevant point.  Removing a global variable
that had to be updated in multiple places (and which XS authors also have
to remember to update) may well be a small win.  I haven't looked deeply
to see whether there might be other drawbacks to removing PL_sv_objcount,
but it looks like the sort of code cleanup that's likely to be useful.

    Andy Dougherty

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About