Details
-
Bug
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
None
-
Query Optimization
-
ALL
Description
Currently PlanExplainerImpl::getSummaryStats makes repeated calls to stageType() which is a virtual function. Since this is a virtual function, the compiler cannot inline the call and also must repeat the call each time it is called as written in the code. A savings of a few instructions and a few function calls can be done by storing the result of this function call in a local variable.
Current Code
if (STAGE_IXSCAN == stages[i]->stageType()) {
|
...
|
} else if(STAGE_COUNT_SCAN == stages[i]->stageType()) {
|
...
|
Suggested Improvement
auto stageType = stages[i]->stageType();
|
if (STAGE_IXSCAN == stageType) {
|
...
|
} else if(STAGE_COUNT_SCAN == stageType) {
|
...
|