CLEANUP: task: cache the task_per_thread pointer
authorWilly Tarreau <w@1wt.eu>
Tue, 24 Sep 2019 05:19:08 +0000 (07:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 24 Sep 2019 09:23:30 +0000 (11:23 +0200)
commit4c1e1ad6a8d1e9b72e8fac422db34c40207b7d8c
treeb9f626fa5ca088451d9b7d9dc8169615fa991807
parent9b48c629f237b8c990a6aca776fb9eda96c3d871
CLEANUP: task: cache the task_per_thread pointer

In process_runnable_tasks() we perform a lot of dereferences to
task_per_thread[tid] but tid is thread_local and the compiler cannot
know that it doesn't change so this results in making lots of thread
local accesses and array dereferences. By just keeping a copy pointer
of this, we let the compiler optimize the code. Just doing this has
reduced process_runnable_tasks() by 124 bytes in the fast path. Doing
the same in wake_expired_tasks() results in 16 extra bytes saved.
src/task.c