[SERVER-69215] Improve AccumulatorTopBottomN() constructor Created: 27/Aug/22  Updated: 29/Oct/23  Resolved: 08/Sep/22

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

Type: Task Priority: Minor - P4
Reporter: Yoon Soo Kim Assignee: Ivan Fefer
Resolution: Fixed Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: QE 2022-09-19
Participants:

 Description   

There are three opportunities to improve AccumulatorTopBottomN<sense, single>::AccumulatorTopBottomN().

We can reserve vector elements so that we don't reallocate it as the vector size grows.

https://github.com/10gen/mongo/blob/master/src/mongo/db/pipeline/accumulator_multi.cpp#L425

We can move objects in follow two cases.

https://github.com/10gen/mongo/blob/master/src/mongo/db/pipeline/accumulator_multi.cpp#L437

https://github.com/10gen/mongo/blob/master/src/mongo/db/pipeline/accumulator_multi.cpp#L442

Better to save this for new engineers and so added neweng label.



 Comments   
Comment by Githook User [ 08/Sep/22 ]

Author:

{'name': 'Ivan Fefer', 'email': 'ivan.fefer@mongodb.com', 'username': 'Fefer-Ivan'}

Message: SERVER-69215 Improve AccumulatorTopBottomN() constructor
Branch: master
https://github.com/mongodb/mongo/commit/8ad6c4b5cdcf9578e11ce6888dd1a884d9cb67d3

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