[SERVER-85158] Audit and remove use of const StringData& and add a lint rule Created: 12/Jan/24 Updated: 16/Jan/24 |
|
| Status: | Open |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | George Wangensteen | Assignee: | Backlog - Service Architecture |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Assigned Teams: |
Service Arch
|
| Sprint: | Service Arch Prioritized List |
| Participants: |
| Description |
|
The code base currently contains many uses of const StringData&, in particular as a function argument. StringData should almost always be passed by value; it is already a view type and is cheap to copy. Passing by value eliminates additional pointer indirections required to pass by reference, and enables the compiler to optimize the code more aggressively. We should remove all the usages we can of passing by reference and add a lint or static analysis rule to catch it in the future. |