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

Re: DAVEM TPF Grant#2 January 2017 report

Thread Previous | Thread Next
From:
Sawyer X
Date:
February 6, 2017 18:18
Subject:
Re: DAVEM TPF Grant#2 January 2017 report
Message ID:
fb2e7c50-96fb-4a1f-d2b0-8b8ca33ee054@gmail.com
Excellent work. Thanks, Dave!

+1!


On 02/06/2017 01:30 PM, Dave Mitchell wrote:
> There are two main things I did in December (along with the usual
> day-to-day stuff).
>
> First I sorted out infrastructure for ops which are called in boolean
> context.
>
> Currently PADHV and RV2HV ops are flagged specially if they are not only
> used in scalar context, but where the result they return will only
> ever be used as a boolean value; for example 'if (%h) {...}'
>
> This was originally done since a hash in scalar context returned a bucket
> usage ratio, which became expensive to calculate when we no longer
> stored the bucket occupancy count with each hash.
>
> In 5.25.x we've changed it so that in scalar context it now only returns a
> key count, which is always known and doesn't need to be calculated on the
> fly. But it can still be quicker to return just a boolean value in
> these cases rather than an integer.
>
> My work took this special-case boolean context detection code in the
> peephole optimiser, and improved it so that:
>
>  * it fixes a bunch of bugs - e.g. if (!%h) {...} wasn't recognised as
>    boolean;
>  * it expands the number of situations that are recognised as boolean
>    context, such as grep:  e.g. grep %$_, @AoH;
>  * it adds a reasonably comprehensive set of tests for checking that ops
>    have been flagged as boolean under various boolean scenarios;
>  * it allows other ops to be easily added to the boolean detection in the
>    optimiser; and to the test suite.
>
> I've also tweaked RV2HV so that in the negative case it just returns
> &PL_sv_no rather than sv_2mortal(newSViv(0)))
>
> I've also pushed a branch davem/boolref2 that allows the ref() function to
> be optimised in boolean context; so 'if (ref $r) {...}' doesn't have to
> generate a temporary string like "Foo=ARRAY(0xc8afd8)". I intend to merge
> this after 5.26, and maybe booleanise a few more ops too (like length()).
>
> The other notable thing I did last month was to change the output format
> produced by the op_dump() function (and perl -Dx). It now displays an
> ASCII-art tree structure, and more low-level information is displayed,
> such as each op's address and class.
>
>
> SUMMARY:
>       3:21 RT #129285 Perl_gv_fullname4 assertion
>       0:36 RT #130617 Perl_rpeep: Assertion ....
>       0:55 RT #130621 Segfault in Perl_vwarner (util.c:2051)
>       0:49 RT #130648 S_pat_upgrade_to_utf8 Assertion ...
>       1:17 RT #130651] regcomp.c:6881 Assertion `expr' failed
>       1:19 RT #130661 perly.c:341: Perl_yyparse: Assertion failed
>       1:03 RT #130667 Perl_sv_clear Assertion `SvTYPE(sv) != ...
>       0:52 RT #130669 Perl_sv_2nv_flags: Assertion `SvTYPE(sv) != ...
>       5:18 [perl #130198] chop(@x =~ tr///)
>       3:00 [perl #130584] Slow pos function in taint mode with \G
>      22:53 [perl #78288] ref and other ops are inefficient in boolean context
>      12:08 change output format of op_dump()
>       3:20 factor out common optree finalisation code
>       4:30 general housekeeping
>      10:41 process p5p mailbox
>       2:51 review security tickets
>     ------
>      74:53 TOTAL (HH::MM)
>
>  172.3 weeks
> 2376.7 total hours
>   13.8 average hours per week
>
> There are 423 hours left on the grant
>
>

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