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

Re: PL_sv_objcount

Thread Previous | Thread Next
Steffen Mueller
March 1, 2013 06:57
Re: PL_sv_objcount
Message ID:
On 02/28/2013 10:14 PM, bulk88 wrote:
> Nicholas Clark wrote:
>> Pretty much *any* real world code of any form is going to end up with
>> PL_sv_objcount non-zero at destruction time.
> What is real world code? LAMP alone?

Code doing non-trivial things. To be honest, I am pretty frustrated that 
we have to belabor this. To indulge you, what seems really rather 
obvious to me is that if you have code where a CONSTANT 30 mu s per 
process matter, then it must be something like the following (in 
whatever shell or language):

for (1..100000) {
   invoke_perl_process("-e", "s/a/b/")

Now, that means a 3s slowdown! But the matter of fact is that this could 
is DOING IT WRONG already. Spawning a new process for something that 
trivial is absolutely, irrevocably, and indubitably the wrong thing to 
do. Process creating is quite expensive, so is Perl startup. 
Particularly on Windows, so you should be aware. If performance matters, 
that code needs to be changed ANYWAY.

This is the last thing I'm going to say about this.

>>> The ++/-- code is unmeasurable. It will be executed async to all the
>>> other instructions ahead/behind it since its not related to any
>>> previous   calculation/data. Regarding "nano optimization", I'll
>>> point out this
>> It will, however, mean that that location has to be kept in the L1 cache.

Not just that, you realize that this is NOT just removing ++/--, right? 
Did you look at the patch? It removes, in several places:

a) The aforementioned increment/decrement.
b) A few binary & operations.
c) On threaded perls, chasing a pointer to access the global variable.
d) Several branches:
     if (SvOBJECT(dstr) && SvTYPE(dstr) != SVt_PVIO)

> Removing optimizations to make life easy is a great plan.

This is removing an optimization in cases where it doesn't matter and 
removing UNNECESSARY WORK in cases where it does.

This patch (the removal) IS an optimization.


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