Repository navigation
perf(chat): cut the emoji sheet's frame time and match the iOS search field and tones - #1610
Merged
Merged
Conversation
… field and tones A fast fling through the sheet ran at a p90 of 29-34ms on a Seeker release build. It now runs at 15-16ms. - Cells click through combinedClickable with no interaction source instead of the composed unboundedClickable, which remembered a source and ripple in every cell on screen. - Rows declare a contentType, and emoji share one dp-sized TextStyle. - The glyph probe over the catalog runs once per sheet on the default dispatcher rather than on main for every settled query. The search field now floats over the grid, frosted with the category bar's Haze blur, and the grid fades out beneath it with ChatTopEdge's ramp. The fade is a surface-colour scrim rather than a DstIn mask: the sheet is opaque, and a mask costs an offscreen layer per frame. The grid and search show base emoji only; long-pressing one with skin tones offers them in a popup. The catalog doesn't link a variant to its base, so skinToneVariants strips the tone modifiers, falling back to the name before the colon for two-person sequences like handshake.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the Seeker, a fast fling through the emoji sheet ran at a p90 frame time of 29–34ms, about half the 120Hz refresh rate. With this change it runs at 15–16ms. This also brings the sheet's search field and skin tones in line with the iOS spec.
Scroll cost
unboundedClickable, a composed modifier that remembered an interaction source and a ripple in every one of the ~50 cells on screen. Cells now usecombinedClickable(interactionSource = null), which creates the source only once pressed.items(rows)now has acontentType, so header and emoji rows are reused within their own type.TextStyleinstead of each cell resolving its own.EmojiPickerViewModelprobes glyph drawability over all 3,944 catalog entries once per sheet onDispatchers.Default, and caches the undrawable set. Before, it re-ran the probe on the main thread for every settled search query.Search field. The capsule floats over the grid, which is padded 16 + 44 + 12dp at the top so the first row rests under it. The capsule is frosted with the same Haze blur as the category bar. The grid fades out over 32dp above where the first row rests, using
ChatTopEdge's eased ramp. The fade is a scrim in the sheet's surface colour, not theDstInmask the spec asks for. The sheet is opaque, so the two look the same, and a mask needs an offscreen layer the size of the grid on every scrolled frame.Skin tones. The catalog lists 2,030 skin-tone variants inline among its 3,944 entries, so the grid showed every tone of every hand. Categories and search results now show base emoji only. Long-pressing one with tones opens a popup with the base and each tone, in rows of five for the 25 two-person variants. Frequently Used keeps a toned emoji as picked. The catalog doesn't say which base a variant belongs to, so
EmojiCatalog.skinToneVariantsstrips the tone modifiers and U+FE0F to find it. For the 240 variants whose base is a different code point, like handshake, it falls back to the name before the colon.SkinToneVariantsTestchecks this against the bundled catalog.code/cashThe runs alternated between the two builds. No run on either build missed a compositor deadline, so
gfxinfo's deadline-based jank count reads close to zero for both; the percentiles are where they differ. I also tried Haze'sPerformancemode on the search blur, and it measured no better (p99 25–30ms).