develooper Front page | perl.perl5.porters | Postings from January 2016

Re: reworked context stack system

Thread Previous | Thread Next
From:
demerphq
Date:
January 8, 2016 15:30
Subject:
Re: reworked context stack system
Message ID:
CANgJU+V7AKm1j9=np7MrGL7YCQ7H2_8fuxS_nnmF=5CYY+CU2Q@mail.gmail.com
On 4 January 2016 at 11:50, Dave Mitchell <davem@iabyn.com> wrote:
> The just-pushed branch smoke-me/davem/contextsB4 contains about 200 commits
> that heavily rework the scope / context stack system (all that PUSHBLOCK,
> POPSUB etc stuff). If it smokes ok, and if there aren't any objections,
> I intend to merge it in a few days' time.
>
> The changes are all to non-api internals, although a few distributions do
> rely on them. grep.cpan.me shows the following XS-containing distributions
> as likely to break:
>
>     2008 EDPRATOMO/Algorithm-Permute-0.12
>     2013 HUGMEIR/Params-Lazy-0.005
>     2015 ZEFRAM/Data-Alias-1.20
>     2015 ANDREASG/Devel-Unwind-0.01
>     2015 RSCHUPP/PAR-Packer-1.028
>     2015 VPIT/Scope-Upper-0.28
>
> Benefits:
>
> Entering, iterating and leaving scopes is now considerably faster; see the
> benchmarks at the end of this email for details. Any code that calls e.g.
> a sub or method or 'for' loop which has a small body, is likely to notice
> the difference. For example this runs about 40% faster (x86_64 system):
>
>     my @a = 1..1000;
>     for (1..30_000) {
>         $_++ for @a;
>     }
>
> and this is 23% faster:
>
>     sub inc { $_[0]++ }
>
>     my @a = 1..1000;
>     for (1..30_000) {
>         inc($_) for @a;
>     }

This is a really nice improvement. One of my pet peeves about Perl is
that properly modularized code is slow. Any patch which reduces the
cost of calling a sub is a good thing in my book. Ones that come with
implementation documentation are even better. :-)

Thanks a lot Dave.

Yves

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