[CXX-984] Improve use of bson_init_static Created: 07/Aug/16  Updated: 17/Nov/17  Resolved: 26/Jun/17

Status: Closed
Project: C++ Driver
Component/s: BSON, Implementation
Affects Version/s: None
Fix Version/s: 3.2.0-rc0

Type: Improvement Priority: Major - P3
Reporter: David Golden Assignee: Isabella Siu (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on CDRIVER-2064 Add bson_iter_init_from_data function Closed
Related
related to CXX-1066 Audit all libmongoc and libbson calls... Closed

 Description   

We call bson_init_static repeatedly and redundantly (e.g. on every element access).
We should call bson_init_static once on view creation and cache the result.

Update: we can't cache a bson_t because it uses internal references and it therefore non-copyable without dangling pointers. We've proposed CDRIVER-2064, which would allow us to construct bson_iter_t structures directly directly from the view buffer.



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

Author:

{u'username': u'iwysiu', u'name': u'Isabella Siu', u'email': u'sakurablossom@blueblueworld.com'}

Message: CXX-984 improve use of bson_init_static
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/41f9a6269180f1ef43a116549e38ee2268f60329

Comment by David Golden [ 22/Feb/17 ]

This is blocked waiting on CDRIVER-2064.

Comment by David Golden [ 05/Oct/16 ]

I've split this to cover the improvement and linked to the general "check all return values" ticket for the other part.

Comment by Andrew Morrow (Inactive) [ 08/Aug/16 ]

I'd argue that it is a bug, which is why I scheduled it for 3.0.2.

Generated at Wed Feb 07 22:01:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.