-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
7u6
The Text node's internal peer uses a struct inner class instance that holds the less commonly set attributes.
Scenegraph's Node class also adopted a similar approach.
But it didn't carry down into the Text class.
It appears as if a Text node is somewhere in the range of 300 bytes large, even before you add in the text string.
So perhaps we can indirectly reference the less commonly used properties.
I looekd over the source and here's a summary
Some are always used - or used a lot
- x
- y
- font
- text
- fontSmoothingType
- impl_layoutBounds (private)
borderline as to how frequently its used is :-
- wrappingWidth
[ I could argue for categorising this with less common since a Text node using wrappingWidth
is probably a "larger" node which might be used in a more sophsticated way needing other
of these properties.
But the rest (if I got them all) are less common
- textOrigin
- boundsType
- underline
-strikethrough
- textAlignment
-baselineOffset
- impl_SelectionStart (private)
- impl_seletionEnd (private)
- impl_CaretShape (private)
- impl_CaretPosition (private)
- impl_CaretBias (private)
That's 11 object refs which I expect is at least 44 bytes.
So we could save 40 bytes per Text node by referencing these off an inner object struct,
This probably only saves about 1/7 of the size of a minimal Text node but it may still be worth doing.
Scenegraph's Node class also adopted a similar approach.
But it didn't carry down into the Text class.
It appears as if a Text node is somewhere in the range of 300 bytes large, even before you add in the text string.
So perhaps we can indirectly reference the less commonly used properties.
I looekd over the source and here's a summary
Some are always used - or used a lot
- x
- y
- font
- text
- fontSmoothingType
- impl_layoutBounds (private)
borderline as to how frequently its used is :-
- wrappingWidth
[ I could argue for categorising this with less common since a Text node using wrappingWidth
is probably a "larger" node which might be used in a more sophsticated way needing other
of these properties.
But the rest (if I got them all) are less common
- textOrigin
- boundsType
- underline
-strikethrough
- textAlignment
-baselineOffset
- impl_SelectionStart (private)
- impl_seletionEnd (private)
- impl_CaretShape (private)
- impl_CaretPosition (private)
- impl_CaretBias (private)
That's 11 object refs which I expect is at least 44 bytes.
So we could save 40 bytes per Text node by referencing these off an inner object struct,
This probably only saves about 1/7 of the size of a minimal Text node but it may still be worth doing.