[MDEV-8715] Obsolete sql_alloc() in favor of THD::alloc() and thd_alloc() Created: 2015-09-01  Updated: 2015-11-26  Resolved: 2015-11-26

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Fix Version/s: 10.2.0

Type: Task Priority: Major
Reporter: Sergey Vojtovich Assignee: Sergey Vojtovich
Resolution: Fixed Votes: 0
Labels: None

Epic Link: Performance: micro optimizations
Sprint: 10.2.0-1

 Description   

Since sql_alloc() doesn't have THD parameter, it has to retrieve THD::mem_root by calling relatively expensive pthread_getspecific(THR_MALLOC).

This can be optimized easily by modifying server to use THD::alloc() and modifying plugins to use thd_alloc().



 Comments   
Comment by Sergey Vojtovich [ 2015-11-19 ]

serg, please review patch for this task.

Comment by Sergei Golubchik [ 2015-11-20 ]

ok to push.

this is all very straightforward, but the question is ­— does it bring any speedup or it only removes the function from the profile, by spreading the overhead over its numerous callers.

Comment by Sergey Vojtovich [ 2015-11-20 ]

serg, the primary purpose of this task is to prevent usage of inefficient function. As for "how much it was actually bad":

  • it called pthread_getspecific(), which can't be spread over it's callers
  • IIRC according to profiler function call convention was over 50%
  • the rest is definitely spread
Generated at Thu Feb 08 07:29:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.