[SERVER-29564] Allow BSONObjBuilder to append to existing BSONObj without copying Created: 12/Jun/17 Updated: 30/Oct/23 Resolved: 20/Jun/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Internal Code |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.9 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Mathias Stearn | Assignee: | Mathias Stearn |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Repl 2017-06-19, Repl 2017-07-10 |
| Participants: |
| Description |
|
It should be able to reuse the SharedBuffer from an owned BSONObj as long as the ref count is 1, meaning that no other objects are using the same SharedBuffer. This addresses a common pattern in our code of needing to append a few fields to a BSONObj we just constructed. |
| Comments |
| Comment by Githook User [ 19/Jun/17 ] |
|
Author: {u'username': u'RedBeard0531', u'name': u'Mathias Stearn', u'email': u'mathias@10gen.com'}Message: This will avoid copying whenever it is safe. |