[SERVER-36475] Reduce use of stringstream in BSONObj.jsonString Created: 06/Aug/18  Updated: 29/Oct/23  Resolved: 08/Aug/18

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

Type: Improvement Priority: Minor - P4
Reporter: Kashish Garg Assignee: Kashish Garg
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-36576 Coverity analysis defect 104963: Not ... Closed
Backwards Compatibility: Fully Compatible
Sprint: Platforms 2018-08-13
Participants:

 Description   

Right now, in order to convert a BSON Object into a JSON string, we recursively call the jsonString() function, which creates a new stringstream for every call. Creating a new stringstream every time is quite expensive. We should only create it once and pass it in as an argument for the successive recursive calls to help improve auditing performance.



 Comments   
Comment by Githook User [ 08/Aug/18 ]

Author:

{'name': 'Kashish Garg', 'email': 'kashish.garg@mongodb.com'}

Message: SERVER-36475 Reduce use of stringstream in BSONObj.jsonString
Branch: master
https://github.com/mongodb/mongo/commit/f10f21467c2c0ae7586c5c9d327f2328f09d655c

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