[SERVER-82433] Remove duplicate calls to VariableEnvironment::build Created: 25/Oct/23  Updated: 31/Oct/23  Resolved: 31/Oct/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.2.0-rc0

Type: Bug Priority: Major - P3
Reporter: Alberto Massari Assignee: Alberto Massari
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: QE 2023-10-30, QE 2023-11-13
Participants:
Linked BF Score: 100

 Description   

Running in a profiler shows that calling it twice is a performance hit

Function Name	Total CPU [unit, %]	Self CPU [unit, %]	Module	Category
| + mongo::stage_builder::abtToExpr	22583 (40,84%)	1 (0,00%)	mongod	Runtime
|| + mongo::stage_builder::constantFold	10808 (19,55%)	0 (0,00%)	mongod	Runtime
||| - mongo::optimizer::VariableEnvironment::build	8791 (15,90%)	0 (0,00%)	mongod	Runtime
||| - mongo::stage_builder::ExpressionConstEval::optimize	745 (1,35%)	0 (0,00%)	mongod	Runtime
||| - mongo::stage_builder::TypeChecker::typeCheck	597 (1,08%)	0 (0,00%)	mongod	Runtime
||| - mongo::optimizer::EvalPathLowering::optimize	535 (0,97%)	0 (0,00%)	mongod	Runtime
||| - mongo::optimizer::VariableEnvironment::~VariableEnvironment	139 (0,25%)	0 (0,00%)	mongod	Runtime
||| - ??@a3a9d768221a184941997bd5c97152c9@	1 (0,00%)	1 (0,00%)	mongod	
|| - mongo::optimizer::VariableEnvironment::build	8976 (16,23%)	0 (0,00%)	mongod	Runtime
|| - mongo::optimizer::SBEExpressionLowering::optimize	2673 (4,83%)	0 (0,00%)	mongod	Runtime
|| - mongo::optimizer::VariableEnvironment::~VariableEnvironment	122 (0,22%)	0 (0,00%)	mongod	Runtime



 Comments   
Comment by Githook User [ 31/Oct/23 ]

Author:

{'name': 'Alberto Massari', 'email': 'alberto.massari@mongodb.com', 'username': 'albymassari'}

Message: SERVER-82433 Avoid constructing VariableEnvironment twice
Branch: master
https://github.com/mongodb/mongo/commit/1ab9bbc101e791752cea894e502c52ebe9dc015d

Generated at Thu Feb 08 06:49:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.