In perl.git, the branch davem/boolref has been created

<http://perl5.git.perl.org/perl.git/commitdiff/9108e50fd89a88637207002130946c9c0b0ecc9d?hp=0000000000000000000000000000000000000000>

        at  9108e50fd89a88637207002130946c9c0b0ecc9d (commit)

- Log -----------------------------------------------------------------
commit 9108e50fd89a88637207002130946c9c0b0ecc9d
Author: David Mitchell <[email protected]>
Date:   Tue Jan 3 12:08:08 2017 +0000

    add an OPpREF_BOOL flag to OP_REF
    
    RT #78288
    
    When ref() is used in a boolean context, it's not necessary to return
    the name of the package which an object is blessed into; instead a simple
    truth value can be returned, which is faster.
    
    Note that it has to cope with the subtlety of an object blessed into the
    class "0", which should return false.
    
    Porting/bench.pl shows for the expression !ref($r), approximately:
        unchanged         for a non-reference $r
        doubling of speed for a reference $r
        tripling of speed for a blessed reference $r
    
    I haven't attempted to use a provisional boolean flag for when the
    expression's context isn't known at compile time (e.g. when used in the
    last expression in a sub), unlike the similar mechanism for rv2hv etc
    which has both OPpTRUEBOOL and OPpMAYBE_TRUEBOOL flags.
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to