Open yuzefovich opened 7 months ago
@yuzefovich could you remind me, what's the approach to take to make these objects not escape?
IIUC there are two allocations that we see in this snippet:
descpb.NameInfo
escapes to the heap because it is passed to methods that take an interface
as an argument. IIUC it is a barrier for the compiler to see whether the value outlives the current call frame.So the solution would be to ideally de-virtualize some of the methods used in this function so that we can use descpb.NameInfo
directly and the compiler could see that it doesn't escape (this would also removing the interface boxing). It's easy to de-virtualize the call to isShadowedName
(by manually inlining the relevant logic), but IsNameInCache
and LookupNamespaceEntry
don't look as trivial. It might be the case that we cannot avoid these allocations.
One of the two heap allocations here is eliminated by https://github.com/cockroachdb/cockroach/pull/134216.
Here is a snippet of
alloc_objects
profile from one of the nodes (on v23.1.17):I'm guessing we could easily avoid these objects escaping.
Jira issue: CRDB-37175
Epic CRDB-42584