[SERVER-27263] bsonExtract*WithDefault inefficient in default case Created: 02/Dec/16  Updated: 06/Dec/17  Resolved: 22/Jun/17

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 3.5.10

Type: Improvement Priority: Major - P3
Reporter: James Wahlin Assignee: Tyler Kaye
Resolution: Done Votes: 0
Labels: neweng, platforms-interns-2017
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-27265 Fast bsonExtract handling for NoSuchK... Closed
Backwards Compatibility: Fully Compatible
Sprint: Platforms 2017-06-19, Platforms 2017-07-10
Participants:

 Description   

The bsonExtract methods in bson_extract.cpp all rely on bsonExtractField() to parse the provided BSONObj. In the case where the requested field is missing, bsonExtractField() will generate an error Status object and build an error message using str::stream() both of which are expensive operations for a non-error path.

We should optimize the "WithDefault" methods to avoid generating an error Status object in the case where the requested field does not exist.



 Comments   
Comment by Githook User [ 22/Jun/17 ]

Author:

{u'username': u'tkaye407', u'name': u'Tyler Kaye', u'email': u'tyler.kaye@mongodb.com'}

Message: SERVER-27263 BSONExtractWithDefault more efficient in the 'no such key' case
Branch: master
https://github.com/mongodb/mongo/commit/66d708336cf0ef6f99f1892b51560857c54bab1f

Generated at Thu Feb 08 04:14:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.