From 940fcbe73bc0aad18bb77a45428126ff987b96c4 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 6 Mar 2020 10:33:11 +0200 Subject: Improved speed of optimizer trace - Added unlikely() to optimize for not having optimizer trace enabled - Made THD::trace_started() inline - Added 'if (trace_enabled())' around some potentially expensive code (not many found) - Added ASSERT's to ensure we don't call expensive optimizer trace calls if optimizer trace is not enabled - Added length to Json_writer functions to speed up buffer writes when optimizer trace is enabled. - Changed LEX_CSTRING argument handling to not send full struct to writer function on_add_str() functions now trusts length arguments --- sql/sql_class.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sql/sql_class.h') diff --git a/sql/sql_class.h b/sql/sql_class.h index 36cb42c6314..2c7e911f808 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3274,7 +3274,10 @@ public: void reset_for_reuse(); bool store_globals(); void reset_globals(); - bool trace_started(); + bool trace_started() + { + return opt_trace.is_started(); + } #ifdef SIGNAL_WITH_VIO_CLOSE inline void set_active_vio(Vio* vio) { @@ -5003,6 +5006,7 @@ public: Item *sp_fix_func_item(Item **it_addr); Item *sp_prepare_func_item(Item **it_addr, uint cols= 1); bool sp_eval_expr(Field *result_field, Item **expr_item_ptr); + }; /** A short cut for thd->get_stmt_da()->set_ok_status(). */ -- cgit v1.2.1