[SERVER-55835] BSONIteratorSorted should reuse calculated fieldName size Created: 06/Apr/21  Updated: 29/Oct/23  Resolved: 08/Apr/21

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

Type: Improvement Priority: Major - P3
Reporter: Henrik Edin Assignee: Henrik Edin
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-55484 Improve efficiency of BucketCatalog::... Closed
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2021-04-19
Participants:

 Description   

BSONIteratorSorted traverses the provided BSONObj to collect all field names. But when storing it just uses char*.

This leads to the comparator having to re-calculate the field name size over and over again during the sorting stage.

Later when a user is extracting BSONElements in sorted order the field name sizes are calculated yet again.

We should be able to just calculate it once and then reuse.



 Comments   
Comment by Githook User [ 08/Apr/21 ]

Author:

{'name': 'Henrik Edin', 'email': 'henrik.edin@mongodb.com', 'username': 'henrikedin'}

Message: SERVER-55835 Reuse calculated field name and value sizes in BSONIteratorSorted
Branch: master
https://github.com/mongodb/mongo/commit/0d88d02dbec6d3e83060e55211b7ce821df3d9d5

Generated at Thu Feb 08 05:37:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.