-
Notifications
You must be signed in to change notification settings - Fork 6k
[Impeller] hash less text stuff per frame for text rendering. #55060
[Impeller] hash less text stuff per frame for text rendering. #55060
Conversation
|
Also moves some Hash/Eq methods to structs so we can be compatible with absl flat_hash_map |
|
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
I think since this is just a refactor of existing functionality, it should be test exempt. PR 2 in this list is not just a refactor and will have tests |
…r#55060) The Glyph color and stroke property are only required for stroked text or COLR text, in all other cases its a no-op. We can do the text hashing faster if we let these properties be optional. ~Also as an experiment switches to absl containers which should be more reasonably performant than std containers.~ required more changes, will try again later
…155046) flutter/engine@ade8ef2...ee5adf6 2024-09-11 [email protected] Zip and upload Xcode xcresults on scenario test failure (flutter/engine#55093) 2024-09-11 [email protected] [Impeller] hash less text stuff per frame for text rendering. (flutter/engine#55060) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Follow up to #55060 Currently we have multiple stages of hashing while font rendering, which is relatively expensive for the actualy required workload. First, we hash the contents of all text frames to compute the unique set of glyphs per frame. Then we diff this hash set against the hashmap of glyphs within the atlas. Finally we hash and lookup the final rendered bounds for each glyph. We can simplify this to 2. hash lookups for glyphs not yet in the atlas and 1. hash lookup for glyphs that are in the atlas. This is done by combing the step where we uniquely compute glyphs per frame with the diff against the current atlas. When this lookup is performed, we also store the glyph position (if found) in the text_frame itself - which allows text contents to skip the last hash, as long as the glyph has already been rendered. ### Before  ### After  Using this handy dandy test app: ```dart import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { Widget build(context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Platform View'), ), body: SafeArea(child: Stack(children: [ SizedBox( width: 380, height: 380, child: LinearProgressIndicator(), ), Stack( children: List<Widget>.generate(1000, (index) { // The problem already happens with a small amount of widgets. // Using an excessive amount of widgets is just to make the problem more evident. return Text("Lots of Texts represent a Widget with complex components."); }), ), Align( alignment: Alignment.bottomCenter, child: TextButton( child: Text("Button"), onPressed: () { print("Tap ${DateTime.now()}"); }, ), ), ], ), ), ), ); } } ```
Reverts: #55092 Initiated by: jonahwilliams Reason for reverting: framework golden failures. Original PR Author: jonahwilliams Reviewed By: {chinmaygarde, jtmcdole} This change reverts the following previous change: Follow up to #55060 Currently we have multiple stages of hashing while font rendering, which is relatively expensive for the actualy required workload. First, we hash the contents of all text frames to compute the unique set of glyphs per frame. Then we diff this hash set against the hashmap of glyphs within the atlas. Finally we hash and lookup the final rendered bounds for each glyph. We can simplify this to 2. hash lookups for glyphs not yet in the atlas and 1. hash lookup for glyphs that are in the atlas. This is done by combing the step where we uniquely compute glyphs per frame with the diff against the current atlas. When this lookup is performed, we also store the glyph position (if found) in the text_frame itself - which allows text contents to skip the last hash, as long as the glyph has already been rendered. ### Before  ### After  Using this handy dandy test app: ```dart import 'package:flutter/material.dart'; void main() { runApp(MyApp()); } class MyApp extends StatelessWidget { Widget build(context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: Text('Platform View'), ), body: SafeArea(child: Stack(children: [ SizedBox( width: 380, height: 380, child: LinearProgressIndicator(), ), Stack( children: List<Widget>.generate(1000, (index) { // The problem already happens with a small amount of widgets. // Using an excessive amount of widgets is just to make the problem more evident. return Text("Lots of Texts represent a Widget with complex components."); }), ), Align( alignment: Alignment.bottomCenter, child: TextButton( child: Text("Button"), onPressed: () { print("Tap ${DateTime.now()}"); }, ), ), ], ), ), ), ); } } ```
The Glyph color and stroke property are only required for stroked text or COLR text, in all other cases its a no-op. We can do the text hashing faster if we let these properties be optional.
Also as an experiment switches to absl containers which should be more reasonably performant than std containers.required more changes, will try again later