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

Re: use of LIKELY() and UNLIKELY() branch predictors

Thread Previous
Nicholas Clark
January 29, 2013 08:29
Re: use of LIKELY() and UNLIKELY() branch predictors
Message ID:
On Mon, Jan 28, 2013 at 10:35:33PM +0000, Tim Bunce wrote:

> I recall suggesting this a few years ago and Nicholas doing some
> experiments that proved inconclusive. My recollection is that I thought
> they needed to be applied in many more places. Specifically, there are
> many low-level macros that look like interetsing targets, along with
> many places in hot code paths.

This was my recollection of trying. That I couldn't measure any difference.
(which was frustrating)

This would be consistent, wouldn't it, with the *code* generated being
different, and appropriate, but the branch prediction on the CPU being
good enough to pretty much make up for it?

That doesn't say "don't do it". It says "not clear how useful this is"

I've just realised that it might make a more noticeable difference on less
complex CPU hardware. Unfortunately I'm not near my Raspberry Pi for the
next few days, else I'd set it off and see.

> Experimenting with this has been at the top of my list of "things I'd do
> if I had more time to work on the perl core", so I'm delighted you're
> looking into it Dave.

If money translates to time, it would be wonderful if you were able to
apply for a grant from the core maint fund to free up some time to experiment
with optimisations

Nicholas Clark

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About