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

Re: [perl #78288] ref and other ops are inefficient in booleancontext

Thread Previous
From:
Dave Mitchell
Date:
August 5, 2017 11:44
Subject:
Re: [perl #78288] ref and other ops are inefficient in booleancontext
Message ID:
20170805114357.GC3091@iabyn.com
On Thu, Jul 27, 2017 at 04:14:18PM -0700, Father Chrysostomos via RT wrote:
> > Also, index() doesn't return a boolean value, but for no match it
> > returns
> > -1. So for code like
> > 
> > if (index(...) != -1) { ... }
> > 
> > optimise away the OP_CONST and the OP_EQ and flag the index op to
> > return a
> > boolean value.
> 
> index(...) >= 0 is also quite common.

I've now added comparison variant like that with v5.27.2-102-g400ffcf.

-- 
The Enterprise's efficient long-range scanners detect a temporal vortex
distortion in good time, allowing it to be safely avoided via a minor
course correction.
    -- Things That Never Happen in "Star Trek" #21

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About