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/table_cache.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/table_cache.cc')
-rw-r--r-- | sql/table_cache.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sql/table_cache.cc b/sql/table_cache.cc index e524e0995e2..3ec528186eb 100644 --- a/sql/table_cache.cc +++ b/sql/table_cache.cc @@ -747,7 +747,7 @@ TDC_element *tdc_lock_share(THD *thd, const char *db, const char *table_name) char key[MAX_DBKEY_LENGTH]; DBUG_ENTER("tdc_lock_share"); - if (fix_thd_pins(thd)) + if (unlikely(fix_thd_pins(thd))) DBUG_RETURN((TDC_element*) MY_ERRPTR); element= (TDC_element *) lf_hash_search(&tdc_hash, thd->tdc_hash_pins, @@ -756,7 +756,7 @@ TDC_element *tdc_lock_share(THD *thd, const char *db, const char *table_name) if (element) { mysql_mutex_lock(&element->LOCK_table_share); - if (!element->share || element->share->error) + if (unlikely(!element->share || element->share->error)) { mysql_mutex_unlock(&element->LOCK_table_share); element= 0; @@ -838,7 +838,7 @@ retry: /* note that tdc_acquire_share() *always* uses discovery */ open_table_def(thd, share, flags | GTS_USE_DISCOVERY); - if (share->error) + if (unlikely(share->error)) { free_table_share(share); lf_hash_delete(&tdc_hash, thd->tdc_hash_pins, key, key_length); @@ -894,7 +894,7 @@ retry: We found an existing table definition. Return it if we didn't get an error when reading the table definition from file. */ - if (share->error) + if (unlikely(share->error)) { open_table_error(share, share->error, share->open_errno); goto err; |