-
Marc Alff authored
Bug#12346211 PERF IMPACT OF PERFORMANCE-SCHEMA WITH DISABLED INSTRUMENTS/CONSUMERS Performance improvement #1: instrumentation interface. In the instrumentation interface in include/mysql/psi/psi.h, implemented the following changes. 1) Removal of "if (PSI_server != NULL)". Instead of having PSI_server == NULL when the performance schema is disabled, a dummy implementation of the instrumentation interface is provided in mysys/psi_noop.cc. Replacing a test by calling an empty function is similar for the disabled code path. For the instrumented code path (the performance schema is enabled), removing this test completely improves performances. 2) Push down of "if (that->m_psi != NULL)". Testing if an object is instrumented has been pushed down to the implementation of the instrumentation interface. In case of psi_noop.cc, this test is not needed, which improves performances for the disabled case. 3) Removal of 1 "if (locker != NULL)" test. Before the fix, the coding pattern was: locker= ... if (locker != NULL) PSI_server->start_event() <instrumented code> if (locker != NULL) PSI_server->end_event() After the fix, the coding pattern is: locker= ... if (locker != NULL) { PSI_server->start_event() <instrumented code> PSI_server->end_event() } else { <instrumented code> } This saves an extra if() in both the instrumented and non instrumented code path. 4) Packing of helper structures. Unused attributes such as m_src_file and m_src_line have been removed. Attributes have been reordered to: - avoid holes caused by padding - put attributes used very frequently first 5) Use PSI_CALL() Calls to the performance schema implementation have been changed from: PSI_server->function(); to PSI_CALL(function)(); This is cosmetic only, and can help later to make static calls to pfs_function() instead of using the PSI_server pointer.
Marc Alff authoredBug#12346211 PERF IMPACT OF PERFORMANCE-SCHEMA WITH DISABLED INSTRUMENTS/CONSUMERS Performance improvement #1: instrumentation interface. In the instrumentation interface in include/mysql/psi/psi.h, implemented the following changes. 1) Removal of "if (PSI_server != NULL)". Instead of having PSI_server == NULL when the performance schema is disabled, a dummy implementation of the instrumentation interface is provided in mysys/psi_noop.cc. Replacing a test by calling an empty function is similar for the disabled code path. For the instrumented code path (the performance schema is enabled), removing this test completely improves performances. 2) Push down of "if (that->m_psi != NULL)". Testing if an object is instrumented has been pushed down to the implementation of the instrumentation interface. In case of psi_noop.cc, this test is not needed, which improves performances for the disabled case. 3) Removal of 1 "if (locker != NULL)" test. Before the fix, the coding pattern was: locker= ... if (locker != NULL) PSI_server->start_event() <instrumented code> if (locker != NULL) PSI_server->end_event() After the fix, the coding pattern is: locker= ... if (locker != NULL) { PSI_server->start_event() <instrumented code> PSI_server->end_event() } else { <instrumented code> } This saves an extra if() in both the instrumented and non instrumented code path. 4) Packing of helper structures. Unused attributes such as m_src_file and m_src_line have been removed. Attributes have been reordered to: - avoid holes caused by padding - put attributes used very frequently first 5) Use PSI_CALL() Calls to the performance schema implementation have been changed from: PSI_server->function(); to PSI_CALL(function)(); This is cosmetic only, and can help later to make static calls to pfs_function() instead of using the PSI_server pointer.
Loading