Join GitHub today
Switch opacity bindings to array, and optimize size of BrushPrimitive. #3336
This is a temporary fix (won't be applicable once types are interned). However, it's such a big difference that I think it's worth landing in the interim. It drops the size of the BrushKind enum from 1632 bytes down to 168 bytes. This structure is a critical struct that is used for every (non-interned) primitive.
There are two patches here.
The first moves opacity binding from being inline in the brush primitive to being a separate array. This makes things easier once I intern images and rectangles.
The second patch makes the border segments be a vec instead of a smallvec. I noticed that the size of the BrushPrimitive was very large, which is fixed by this. This is a temporary fix, it won't be needed once the primitives are interned, but it is a big enough win that it's worth having for now. It drops the size of each
Switch opacity bindings to array, and optimize size of BrushPrimitive. <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/3336) <!-- Reviewable:end -->