[SERVER-81569] Improve performance of NamespaceString Created: 29/Sep/23 Updated: 06/Feb/24 |
|
| Status: | In Code Review |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Matthew Russotto | Assignee: | Didier Nadeau |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | car-investigation, ntdi_performance, perf-8.0, perf-tiger, perf-tiger-handoff, perf-tiger-poc, perf-tiger-q4 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Assigned Teams: |
Service Arch
|
||||||||||||||||||||||||
| Sprint: | Service Arch 2023-12-11, Service Arch 2024-01-22, Service Arch 2024-02-05, Service Arch 2024-02-19 | ||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||
| Description |
|
The NamespaceString::ConstantProxy and DatabaseName::ConstantProxy classes currently uses std::call_once to provide access to a NamespaceString object; this is done on every access to the NamespaceString constants. Since std::call_once must do atomic operations, it is fairly expensive, and adds several hundred nanoseconds to opObserver calls just to check that an opObserver shouldn't run. Additionally, before we had tenantId, getting the database for a NamespaceString was a cheap operation that just got a reference; it now requires a copy. Ideally we would have a DatabaseNameRef class that could be used almost anyplace a DatabaseName is, with DatabaseName reserved for when we need to actually store one. |