Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2266,6 +2266,10 @@ bool calculateLayoutInternal(
(performLayout ? layoutMarkerData.cachedLayouts
: layoutMarkerData.cachedMeasures) += 1;
} else {
// Track cache misses for computing hit rates
(performLayout ? layoutMarkerData.layoutCacheMisses
: layoutMarkerData.measureCacheMisses) += 1;

calculateLayoutImpl(
node,
availableWidth,
Expand Down
4 changes: 4 additions & 0 deletions packages/react-native/ReactCommon/yoga/yoga/event/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ struct LayoutData {
uint32_t maxMeasureCache = 0;
int cachedLayouts = 0;
int cachedMeasures = 0;
// Cache misses occur when a cached result is not found and layout must be
// recalculated. Track these to compute cache hit rates.
int layoutCacheMisses = 0;
int measureCacheMisses = 0;
int measureCallbacks = 0;
std::array<int, static_cast<uint8_t>(LayoutPassReason::COUNT)>
measureCallbackReasonsCount;
Expand Down
Loading