Remove hash_layout method from Widget trait#1263
Merged
Merged
Conversation
58368fb to
1313c94
Compare
greatest-ape
added a commit
to greatest-ape/iced_audio
that referenced
this pull request
Mar 18, 2022
Widget::hash_layout was removed in iced-rs/iced#1263
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.
This PR removes the
hash_layoutmethod from theWidgettrait.This method was added before the very first release of
icedfor two main reasons:stretchand was very slow (4ms for basic examples!). However, after Custom layout engine #52 landed, our layout engine is around 1-2 orders of magnitude faster now!viewlogic was executed repeatedly for every single event batch in our event loop and, as such, we needed to consider potential layout changes. After Rebuild widget tree only after an application update #597, we only rebuild the widget tree after aMessageis processed. Given that layout cannot change if the widget tree does not change, we only recompute layout in this instance too.After #52 and #597, the
hash_layoutmethod does rarely help improve performance. In fact, given that layout is only recomputed after anupdate, the resulting hash is likely to be different in almost every case. As a consequence, the runtime is most likely hitting the worst case (hashing + relayout) very often.In conclusion, we can safely remove the
hash_layoutmethod; reducing theWidgetsurface as a result and slightly improving performance and correctness.