[SERVER-42712] Improve copy assignment performance of KeyString::Value Created: 08/Aug/19  Updated: 29/Oct/23  Resolved: 20/Aug/19

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

Type: Improvement Priority: Major - P3
Reporter: Louis Williams Assignee: Louis Williams
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
Backwards Compatibility: Fully Compatible
Sprint: Execution Team 2019-08-26
Participants:
Linked BF Score: 0

 Description   

Copy assignment of KeyString::Value is currently slow for a few reasons:

  • It must call the copy assignment for TypeBits, preventing the structure's assignment from being inlined efficiently. This can be improved by transparently always appending TypeBits to the end of the buffer, but never including it in the actual KeyString.
  • It must call the destructor for the local ConstSharedBuffer, and created a copy of the source buffer, subtracting and adding an atomic ref-counter on each. This shows up in perf and can be improved by implementing a swapping assignment like BSON does today.


 Comments   
Comment by Githook User [ 20/Aug/19 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-42712 Improve KeyString::Value copy assignemnt
Branch: master
https://github.com/mongodb/mongo/commit/c1bd6bb98e189d33ca7e044d549d1be2a11be20d

Comment by Githook User [ 20/Aug/19 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: Revert "SERVER-42712 Improve KeyString::Value copy assignemnt"

This reverts commit cb3704ac02751e6369db7333e04ed54ab748f6da.
Branch: master
https://github.com/mongodb/mongo/commit/36aacf391a13eba67648f1cf625fe26515454a70

Comment by Githook User [ 20/Aug/19 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-42712 Improve KeyString::Value copy assignemnt
Branch: master
https://github.com/mongodb/mongo/commit/cb3704ac02751e6369db7333e04ed54ab748f6da

Comment by Githook User [ 20/Aug/19 ]

Author:

{'name': 'Louis Williams', 'email': 'louis.williams@mongodb.com', 'username': 'louiswilliams'}

Message: SERVER-42712 Add benchmarks for KeyString releasing, copying, and assignment
Branch: master
https://github.com/mongodb/mongo/commit/910ce4061d9496c9b9736a538c17ad0e3a1d706b

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