-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Impeller] faster glyph atlas generation by removing data copies #41290
Conversation
…ions of fonts. - updated the existing test to be a proper unit test
This reverts commit 383d200.
72c2f6a
to
c3238c1
Compare
@@ -141,8 +134,9 @@ static bool CanAppendToExistingAtlas( | |||
return true; | |||
} | |||
|
|||
static ISize OptimumAtlasSizeForFontGlyphPairs( | |||
const FontGlyphPair::Vector& pairs, | |||
namespace { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does putting in a namespace like this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should have no functional difference in this case. I was playing around with making that function templated and looks like I left that change in there by happenstance.
size_t i = 0; | ||
for (auto it = pairs.begin(); it != pairs.end(); ++i, ++it) { | ||
const auto& pair = *it; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really love this. Does it make a significant improvement on the generated code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was required because you can't index into std::unordered_set
. We could use a foreach loop but it isn't really cleaner imo.
Previously we were copying all of the data in the std::unordered_set
to make a std::vector
just so we could cleanly index into the data. But since the order of iteration of an std::unordered_set
is deterministic, we don't really need to copy the data just to index into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits
…125069) flutter/engine@6d263ea...5fcc7b7 2023-04-18 dnfield@google.com [Impeller] Gpu model information to Skia gold (flutter/engine#41216) 2023-04-18 30870216+gaaclarke@users.noreply.github.com [Impeller] faster glyph atlas generation by removing data copies (flutter/engine#41290) 2023-04-18 godofredoc@google.com Migrate android AOT to engine_v2. (flutter/engine#41229) 2023-04-18 skia-flutter-autoroll@skia.org Roll Skia from 5bd4bdc0d8e2 to f80ee1088861 (8 revisions) (flutter/engine#41302) 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 chinmaygarde@google.com,rmistry@google.com,zra@google.com 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
fixes flutter/flutter#124996
This is the best I could come up with easily. It doesn't give as good of a result as I'd hoped. I measured it with a simple microbenchmark derived from one of the unit tests and it gave a 6% decrease in time ( 241.314us vs 257.626us) on macos release builds (run with rosetta).
Improvements:
the benchmark
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.