1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Add likely/unlikely to speed up execution

Added to:
- if (error)
- Lex
- sql_yacc.yy and sql_yacc_ora.yy
- In header files to alloc() calls
- Added thd argument to thd_net_is_killed()
This commit is contained in:
Monty
2018-04-04 12:16:12 +03:00
parent a22a339f8e
commit 30ebc3ee9e
118 changed files with 4874 additions and 4440 deletions

View File

@@ -393,7 +393,7 @@ static int lock_external(THD *thd, TABLE **tables, uint count)
(*tables)->reginfo.lock_type <= TL_READ_NO_INSERT))
lock_type=F_RDLCK;
if ((error=(*tables)->file->ha_external_lock(thd,lock_type)))
if (unlikely((error=(*tables)->file->ha_external_lock(thd,lock_type))))
{
(*tables)->file->print_error(error, MYF(0));
while (--i)
@@ -439,7 +439,7 @@ void mysql_unlock_tables(THD *thd, MYSQL_LOCK *sql_lock, bool free_lock)
DBUG_ASSERT(!(sql_lock->flags & GET_LOCK_ON_THD));
my_free(sql_lock);
}
if (!errors)
if (likely(!errors))
thd->clear_error();
THD_STAGE_INFO(thd, org_stage);
DBUG_VOID_RETURN;
@@ -726,7 +726,7 @@ static int unlock_external(THD *thd, TABLE **table,uint count)
if ((*table)->current_lock != F_UNLCK)
{
(*table)->current_lock = F_UNLCK;
if ((error=(*table)->file->ha_external_lock(thd, F_UNLCK)))
if (unlikely((error=(*table)->file->ha_external_lock(thd, F_UNLCK))))
{
error_code= error;
(*table)->file->print_error(error, MYF(0));