diff options
author | Monty <monty@mariadb.org> | 2018-04-04 12:16:12 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-05-07 00:07:32 +0300 |
commit | 30ebc3ee9efcab635b1f3e14b9198a58ae93c233 (patch) | |
tree | 81e3ad66cd4ec8693964317cbf23515d0e9ecf35 /sql/lock.cc | |
parent | a22a339f8e044a1e8df011beb0b4c8f43792ac96 (diff) | |
download | mariadb-git-30ebc3ee9efcab635b1f3e14b9198a58ae93c233.tar.gz |
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()
Diffstat (limited to 'sql/lock.cc')
-rw-r--r-- | sql/lock.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sql/lock.cc b/sql/lock.cc index 1bb80e01fb0..17629f17291 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -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)); |