Skip to content

Commit

Permalink
Shrink TextNode(2) (TextureGroup#1495)
Browse files Browse the repository at this point in the history
Running in iPhone SE Simulator:
- ASTextNode: 1360 to 1352 bytes .6% reduction
- ASTextNode2: 1360 to 1304 bytes 4.3% redction

Shrink stored enum sizes. Group BOOLs near these smaller enums. Override -usingExperiment to return constant instead of never set, but allocated ivar.
  • Loading branch information
Greg Bolsinga authored and hebertialmeida committed May 10, 2019
1 parent 8d0457c commit ad6b6ab
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion Source/ASTextNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,13 @@ @implementation ASTextNode {

NSString *_highlightedLinkAttributeName;
id _highlightedLinkAttributeValue;
ASTextNodeHighlightStyle _highlightStyle;
NSRange _highlightRange;
ASHighlightOverlayLayer *_activeHighlightLayer;

UILongPressGestureRecognizer *_longPressGestureRecognizer;
ASTextNodeHighlightStyle _highlightStyle;
BOOL _longPressCancelsTouches;
BOOL _passthroughNonlinkTouches;
}
@dynamic placeholderEnabled;

Expand Down Expand Up @@ -265,6 +267,11 @@ - (void)dealloc
CGColorRelease(_shadowColor);
}

- (BOOL)usingExperiment
{
return NO;
}

#pragma mark - Description

- (NSString *)_plainStringForDescription
Expand Down
4 changes: 3 additions & 1 deletion Source/ASTextNode2.mm
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,14 @@ @implementation ASTextNode {

NSString *_highlightedLinkAttributeName;
id _highlightedLinkAttributeValue;
ASTextNodeHighlightStyle _highlightStyle;
NSRange _highlightRange;
ASHighlightOverlayLayer *_activeHighlightLayer;
UIColor *_placeholderColor;

UILongPressGestureRecognizer *_longPressGestureRecognizer;
ASTextNodeHighlightStyle _highlightStyle;
BOOL _longPressCancelsTouches;
BOOL _passthroughNonlinkTouches;
}
@dynamic placeholderEnabled;

Expand Down
2 changes: 1 addition & 1 deletion Source/ASTextNodeCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
/**
* Highlight styles.
*/
typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) {
typedef NS_ENUM(unsigned char, ASTextNodeHighlightStyle) {
/**
* Highlight style for text on a light background.
*/
Expand Down

0 comments on commit ad6b6ab

Please sign in to comment.