ASLayoutElementStyle has a large memory footprint since ASDimension does
Will multiple ASDimensions with different ASDimensionUnit values all used within one ASLayoutElementStyle instance occur in the real world? I'm asking because ASLayoutElementStyle basically has 12 of these that I can move next to each other. But ASDimensionUnit is basically a 2-bit value that is taking up 8 bytes of memory. There are 1000s of ASLayoutElementStyle in the heap after running Pinterest for a very short time.
If there was something like a special case that knew that all the ASDimentionUnit were all the same, this hypothetical class could be 12*8 bytes smaller in the heap.
@Adlai-Holler @appleguy @maicki @garrettmoon @nguyenhuy What are your thoughts?
Would we get a nice win by reformulating ASLayoutElementSize to pack those ASDimensionUnit values together separate from the CGFloat values? Something like 6 2-bit ints (packed units) followed by 6 CGFloats? Then in the accessors we can rearrange values into proper ASDimensions.
On May 8, 2019, at 8:51 PM, Greg Bolsinga [email protected] wrote:
Will multiple ASDimensions with different ASDimensionUnit values all used within one ASLayoutElementStyle instance occur in the real world? I'm asking because ASLayoutElementStyle basically has 12 of these that I can move next to each other. But ASDimensionUnit is basically a 2-bit value that is taking up 8 bytes of memory. There are 1000s of ASLayoutElementStyle in the heap after running Pinterest for a very short time.
If there was something like a special case that knew that all the ASDimentionUnit were all the same, this hypothetical class would be 12*8 bytes smaller in the heap.
@Adlai-Holler @appleguy @maicki @garrettmoon @nguyenhuy What are your thoughts?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
That would help too. Are there many of these that all use different ASDimensionUnits?