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

Re: [perl #114576] check if %hash 500x times slower than if keys%hash

Thread Previous
From:
Dave Mitchell
Date:
March 27, 2017 17:38
Subject:
Re: [perl #114576] check if %hash 500x times slower than if keys%hash
Message ID:
20170327173743.GT3342@iabyn.com
On Mon, Dec 26, 2016 at 05:24:14PM -0800, James E Keenan via RT wrote:
> On Tue, 21 Jun 2016 18:51:42 GMT, demerphq wrote:
> > On 21 June 2016 at 16:44, Sawyer X <xsawyerx@gmail.com> wrote:
> > >
> > >
> > > On 06/20/2016 08:14 PM, Lukas Mai wrote:
> > >> Am 17.06.2016 um 22:17 schrieb demerphq:
> > >>> On 17 June 2016 at 22:15, demerphq <demerphq@gmail.com> wrote:
> > >>>> If you mean changing the signature of scalar(%hash). IMO yes, we
> > >>>> should, and if there is support for doing so the
> > >>>
> > >>> then yes I am interested in implementing this for 5.25.x.
> > >>
> > >> I'd like that.
> > >
> > > If we're voting, I'll throw a +1 on that too. :)
> > 
> > I just pushed a branch that contains code to do this as: smoke-
> > me/no_xhv_fill
> > 
> > The patch relevant to this thread is
> > 
> > commit 28ecb9747cbb8efad36d9f022e2ef47ba54c6e14
> > Author: Yves Orton <demerphq@gmail.com>
> > Date:   Mon Jun 20 22:51:38 2016 +0200
> > 
> > Change scalar(%hash) to be the same as 0+keys(%hash)
> > 
> > I am going to start a new thread to discuss this.
> > 
> > Yves
> 
> This ticket was originally filed back in 2012 and was a complaint about
> performance.  Have we addressed the original poster's concerns?  Is the
> ticket closeable?

As far as I'm aware, yes. FC fixed up some of the boolean context stuff,

then Yves added:

    8bf4c40 Change scalar(%hash) to be the same as 0+keys(%hash)

then I reworked the boolean context stuff to be more general.

So in 5.25.10, the OP's benchmark code is now fast for all cases (I had to
disable the 'keys $hash' benchmark case, as that's no longer supported)

I'll close this ticket now.

-- 
Dave's first rule of Opera:
If something needs saying, say it: don't warble it.

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