The nss() function forces callers to always make a copy of the Namespace string. NamespaceString checks are not uncommon, so the cost of these small memory allocations can add up over time.
We should just use a raw pointer or return an optional reference to the underlying NSS.
The specific function call that I saw show up when profiling was this isSystemDotProfile function call, which is in our hot write path on the primary.
- is duplicated by
-
SERVER-77640 Remove unnecessary copies caused by NamespaceStringOrUUID interface
- Closed
-
SERVER-74073 Have NamespaceStringOrUUID::nss() return boost::optional<const NamespaceString&> to avoid copies
- Closed