Performance of global access versus thread local

Roland McGrath roland@hack.frob.com
Wed Sep 25 21:38:00 GMT 2013


If you're going to use a DSO like that, you should use LD_BIND_NOW=1 to
keep startup overhead out of your measured loops.  There is no real need to
use a DSO though.  I'm guessing you did so just to make sure the tested
accesses were the PIC flavors.  You can just compile the main program with
-fPIC for that.

For the global case, it would be a hidden global within libc itself.
So you need the  __attribute__ ((visibility ("hidden"))) variant to
be representative of what the accesses inside libc would do.

It's probably better to write the two accesses by hand in assembly--or at
least show us the disassembly of what you compiled--to be sure they are
really representative of what the special-case assembly access in libc
would do.



More information about the Libc-alpha mailing list