[MDEV-19080] replace pthread_getspecific() with C++11 thread_local in dbug.c Created: 2019-03-29  Updated: 2019-09-17  Resolved: 2019-09-17

Status: Closed
Project: MariaDB Server
Component/s: Debug
Fix Version/s: N/A

Type: Task Priority: Major
Reporter: Eugene Kosov (Inactive) Assignee: Eugene Kosov (Inactive)
Resolution: Won't Fix Votes: 0
Labels: None


 Description   

thread_local is faster a simpler than function call. https://godbolt.org/z/whHsjI

I'm running main suite tests in debug mode with -O2 optimizations, for example, for Spent 1556.669 of 260 seconds executing testcases and with thread_local, for example, for Spent 1484.632 of 246 seconds executing testcases.

Patch requires transferring dbug.c from C to C++. C11 would fit too, but it's not used in MariaDB.

Similar technique could be used also for THD and PFS.



 Comments   
Comment by Eugene Kosov (Inactive) [ 2019-06-23 ]

10.4 supports gcc 4.7 which doesn't have implementation for thread_local. Move this issue to 10.5 in hope that it will have a more modern compiler.

Comment by Michael Widenius [ 2019-09-17 ]

As dbug.c is used by C programs, we can't use thread_local in dbug.c

Generated at Thu Feb 08 08:48:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.