[SERVER-55501] Avoid element-wise iteration and copy when appending to an object in doc_diff::applyDiff Created: 24/Mar/21 Updated: 29/Apr/21 Resolved: 29/Apr/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Dan Larkin-York | Assignee: | Dan Larkin-York |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Sprint: | Execution Team 2021-04-19, Execution Team 2021-05-03 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
The current algorithm iterates over each field in the subdocument and copies it individually when adding a new field. In the timeseries case, where we may have hundreds of fields in each "column", this can be pretty bad quadratic behavior. The goal of this task is not to remove the quadratic behavior, but rather to minimize the coefficient for it by short-cutting: when we know we are just appending a field, we can take advantage of this to do a memcpy on the underlying BSON binary data, and just adjust the length for the subdocument to account for the new element. |
| Comments |
| Comment by Githook User [ 28/Apr/21 ] |
|
Author: {'name': 'Dan Larkin-York', 'email': 'dan.larkin-york@mongodb.com', 'username': 'dhly-etc'}Message: |