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

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

Thread Previous | Thread Next
From:
Tim Bunce
Date:
January 30, 2013 17:42
Subject:
Re: use of LIKELY() and UNLIKELY() branch predictors
Message ID:
20130130174206.GG3369@timac.local
On Wed, Jan 30, 2013 at 04:21:44PM +0000, Dave Mitchell wrote:
> On Tue, Jan 29, 2013 at 01:58:03PM -0500, bulk88 wrote:
> > Dave Mitchell wrote:
> > >Perl defines the LIKELY() and UNLIKELY() macros, which (under gcc)
> > >tell the compiler whether a particular expression is likely to be true or
> > >not. This allows you to re-write something like
> > 
> > Why do it by hand, rather than use
> > http://en.wikipedia.org/wiki/Profile-guided_optimization with a real
> > work load (what is a real workload?)?
> 
> Well, there's the rub. perl doesn't have a standard "workload" suite. The
> test suite is specifically not useful for this sort of thing, since it
> likes testing edge cases and exercising all those branches that would
> normally not be taken.
> 
> And one person's "standard" workload is another person's atypical one.
> Realistically, any profiling should be done by the end user on perl
> running their own applications to build a perl optimised for their own
> workload.

I expect there are many macros and if()'s that have an obvious
LIKELY/UNLIKELY state for all but the most contrived workloads.

Tim.

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