mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Use LRU to cache results of ParagraphShadowNode::measure
Summary: Use a folly LRU implementation to cache results of ParagraphShadowNode::measure, which Yoga asks for repeatedly. Should have a substantial speed improvement on Android and iOS, or at least that's the dream. Reviewed By: mdvacca Differential Revision: D13795808 fbshipit-source-id: 5716af0fe0517a72716e48113c8125bb788735d7
This commit is contained in:
committed by
Facebook Github Bot
parent
af1f2728a0
commit
a9049442f7
@@ -10,6 +10,7 @@
|
||||
#include <react/attributedstring/conversions.h>
|
||||
#include <react/core/conversions.h>
|
||||
#include <react/graphics/conversions.h>
|
||||
#include <react/utils/FloatComparison.h>
|
||||
#include <cmath>
|
||||
|
||||
#include <react/debug/debugStringConvertibleUtils.h>
|
||||
@@ -101,16 +102,11 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const {
|
||||
return std::tie(
|
||||
foregroundColor,
|
||||
backgroundColor,
|
||||
opacity,
|
||||
fontFamily,
|
||||
fontSize,
|
||||
fontSizeMultiplier,
|
||||
fontWeight,
|
||||
fontStyle,
|
||||
fontVariant,
|
||||
allowFontScaling,
|
||||
letterSpacing,
|
||||
lineHeight,
|
||||
alignment,
|
||||
baseWritingDirection,
|
||||
textDecorationColor,
|
||||
@@ -118,23 +114,17 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const {
|
||||
textDecorationLineStyle,
|
||||
textDecorationLinePattern,
|
||||
textShadowOffset,
|
||||
textShadowRadius,
|
||||
textShadowColor,
|
||||
isHighlighted,
|
||||
layoutDirection) ==
|
||||
std::tie(
|
||||
rhs.foregroundColor,
|
||||
rhs.backgroundColor,
|
||||
rhs.opacity,
|
||||
rhs.fontFamily,
|
||||
rhs.fontSize,
|
||||
rhs.fontSizeMultiplier,
|
||||
rhs.fontWeight,
|
||||
rhs.fontStyle,
|
||||
rhs.fontVariant,
|
||||
rhs.allowFontScaling,
|
||||
rhs.letterSpacing,
|
||||
rhs.lineHeight,
|
||||
rhs.alignment,
|
||||
rhs.baseWritingDirection,
|
||||
rhs.textDecorationColor,
|
||||
@@ -142,10 +132,15 @@ bool TextAttributes::operator==(const TextAttributes &rhs) const {
|
||||
rhs.textDecorationLineStyle,
|
||||
rhs.textDecorationLinePattern,
|
||||
rhs.textShadowOffset,
|
||||
rhs.textShadowRadius,
|
||||
rhs.textShadowColor,
|
||||
rhs.isHighlighted,
|
||||
rhs.layoutDirection);
|
||||
rhs.layoutDirection) &&
|
||||
floatEquality(opacity, rhs.opacity) &&
|
||||
floatEquality(fontSize, rhs.fontSize) &&
|
||||
floatEquality(fontSizeMultiplier, rhs.fontSizeMultiplier) &&
|
||||
floatEquality(letterSpacing, rhs.letterSpacing) &&
|
||||
floatEquality(lineHeight, rhs.lineHeight) &&
|
||||
floatEquality(textShadowRadius, rhs.textShadowRadius);
|
||||
}
|
||||
|
||||
bool TextAttributes::operator!=(const TextAttributes &rhs) const {
|
||||
|
||||
Reference in New Issue
Block a user