[Impeller] trimmed 3 bytes off of each Glyph (flutter/engine#44054)
While profiling Impeller I saw that we were allocating ~80MB/s of `GlyphPosition`s. This should shave off 13MB/s by making Glyphs 20 bytes instead of 24. <img width="1220" alt="Screenshot 2023-07-26 at 4 51 24 PM" src="https://github.com/flutter/engine/assets/30870216/9e65e8bf-9333-4dd1-aa0b-be771412d07b"> [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
@@ -17,7 +17,7 @@ namespace impeller {
|
||||
/// @brief The glyph index in the typeface.
|
||||
///
|
||||
struct Glyph {
|
||||
enum class Type {
|
||||
enum class Type : uint8_t {
|
||||
kPath,
|
||||
kBitmap,
|
||||
};
|
||||
@@ -39,6 +39,10 @@ struct Glyph {
|
||||
: index(p_index), type(p_type), bounds(p_bounds) {}
|
||||
};
|
||||
|
||||
// Many Glyph instances are instantiated, so care should be taken when
|
||||
// increasing the size.
|
||||
static_assert(sizeof(Glyph) == 20);
|
||||
|
||||
} // namespace impeller
|
||||
|
||||
template <>
|
||||
|
||||
Reference in New Issue
Block a user