Skip to content

v2025.12.22.00

@afrind afrind tagged this 21 Dec 17:47
Summary:
I noticed a pattern of

if (!exists(id)) {
...
}
stream = getStream(id);
XCHECK(stream)

This pattern is actually checking two different maps.  exists() checks a map of the IDs of streams explicitly or implicitly opened, while getStream returns actual stream state, materializing it if it's never been accessed.

This is not optimized for the most common case -- the stream "exists" and has state.  Write a new accesor that checks for state first, then fallback to the exists/get pattern.

Reviewed By: jbeshay

Differential Revision: D87898601

fbshipit-source-id: 04644cc70c7a5cdfb33f0b2a41c01b577bbdced3
Assets 2
Loading