Performance of global access versus thread local

Will Newton will.newton@linaro.org
Wed Sep 25 20:53:00 GMT 2013


Hi,

I've been trying to build a benchmark to measure the performance of
accessing a thread pointer relative variable versus a global variable,
in order to examine the trade-offs in implementing stack guard and
pointer guard.

Using the attached code[1] I get the following numbers:

Core i5 (x86_64):

TLS ticks per 1000 loops: 0.0000101905 Global ticks per 1000 loops: 0.0000100481

(which is understandable, as the two code sequences are practically identical)

Cortex-A15 (arm):

TLS ticks per 1000 loops: 0.0000052731 Global ticks per 1000 loops: 0.0000064143

Does this test look valid? I would be interested to see if anyone else
gets different numbers on different platforms.

[1] gcc -shared -fPIC -O2 tlsvglobal.c -o libtlsvglobal.so
   gcc -O2 main.c -o main -L. -ltlsvglobal -lrt
   LD_LIBRARY_PATH=. ./main

-- 
Will Newton
Toolchain Working Group, Linaro
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.c
Type: text/x-csrc
Size: 841 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20130925/50141a6e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tlsvglobal.c
Type: text/x-csrc
Size: 276 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20130925/50141a6e/attachment-0001.bin>


More information about the Libc-alpha mailing list