This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] malloc: remove __builtin_expect


On 01/26/2016 11:59 AM, Jörn Engel wrote:
On Tue, Jan 26, 2016 at 10:56:49AM +0300, Yury Gribov wrote:
On 01/26/2016 03:24 AM, Joern Engel wrote:
From: Joern Engel <joern@purestorage.org>

It was disabled anyway and only served as obfuscation.  No change
post-compilation.

FYI I've witnessed significant improvements from (real) __builtin_expect in
other projects.

Interesting.  I tried to find any effect and couldn't.  Michael Kerrisk
managed to write an example program that demonstrated the advantage:
http://blog.man7.org/2012/10/how-much-do-builtinexpect-likely-and.html

I tried his program and again couldn't demonstrate any effect.  Not that
I question his numbers, there likely was an effect using his compiler
and machine.  But with a newer compiler and/or cpu, the effect was gone.

So if you have a reference to the project and can replicate the
improvement, I would be interested.

Ok, it took time to dig the archives: http://comments.gmane.org/gmane.comp.debugging.address-sanitizer/1288 . Basically adding __builtin_expect in an important hot-path saved 20% of performance (that's on Clang though).

Jörn

--
It's worth remembering that one reason the Internet succeeded was that
it did not need the permission of the local telcos  in order to get up
and going.
-- iang




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]