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/opt_subselect.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/opt_subselect.cc')
-rw-r--r-- | sql/opt_subselect.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index 3abf879e6da..ef69f27bb1e 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -4352,7 +4352,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd) } } - if (thd->is_fatal_error) // If end of memory + if (unlikely(thd->is_fatal_error)) // If end of memory goto err; share->db_record_offset= 1; table->no_rows= 1; // We don't need the data @@ -4361,10 +4361,11 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd) recinfo++; if (share->db_type() == TMP_ENGINE_HTON) { - if (create_internal_tmp_table(table, keyinfo, start_recinfo, &recinfo, 0)) + if (unlikely(create_internal_tmp_table(table, keyinfo, start_recinfo, + &recinfo, 0))) goto err; } - if (open_tmp_table(table)) + if (unlikely(open_tmp_table(table))) goto err; thd->mem_root= mem_root_save; @@ -4476,7 +4477,7 @@ int SJ_TMP_TABLE::sj_weedout_check_row(THD *thd) } error= tmp_table->file->ha_write_tmp_row(tmp_table->record[0]); - if (error) + if (unlikely(error)) { /* create_internal_tmp_table_from_heap will generate error if needed */ if (!tmp_table->file->is_fatal_error(error, HA_CHECK_DUP)) @@ -5297,7 +5298,8 @@ enum_nested_loop_state join_tab_execution_startup(JOIN_TAB *tab) hash_sj_engine->materialize_join->exec(); hash_sj_engine->is_materialized= TRUE; - if (hash_sj_engine->materialize_join->error || tab->join->thd->is_fatal_error) + if (unlikely(hash_sj_engine->materialize_join->error) || + unlikely(tab->join->thd->is_fatal_error)) DBUG_RETURN(NESTED_LOOP_ERROR); } } |