-
Notifications
You must be signed in to change notification settings - Fork 621
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
Cache varstore #3605
Cache varstore #3605
Conversation
I see 4% speedup in shaping of a simple variable font, and up to 32% speedup in shaping of RobotoFlex, which is a heavy variable font. Even for shaping of single words, 19% speedup. Non-variable font shaping performance is unaffected. These numbers are with hb font-funcs.
Just looking at advance-width speedup, for simple variable font, 30% speedup, for RobotoFlex, 50%.
|
Is faster. With this, I'm seeing 25 to 28% speedup in glyph_h_advances benchmark of benchmark-font for var/hb tests.
It's available so no need to use void*.
Thanks for doing this optimisation. |
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.
🤦♂️ Github ate my homework, I meant to send this review with minor comments but it was hanging in pending state and I didn't send it. LGTM with some remarks. Anyway, thanks again!
@@ -310,7 +311,7 @@ struct hmtxvmtx | |||
|
|||
unsigned int default_advance; | |||
|
|||
private: | |||
public: |
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.
Why is visiblity changing here?
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.
var_table
is now accessed from hb-ot-font
to access the VarStore to create the cache.
{ | ||
if (unlikely (region_index >= regionCount)) | ||
return 0.; | ||
|
||
float *cached = nullptr; |
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.
Nit: cached and cache as variable names in the same scope here read somewhat confusingly. Maybe cached_value
?
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.
Good point. Will do.
@@ -335,7 +340,7 @@ struct HVARVVAR | |||
|
|||
bool has_side_bearing_deltas () const { return lsbMap && rsbMap; } | |||
|
|||
protected: | |||
public: |
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.
Similar question here, why does the visibility need to change - I didn't understand that.
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.
Same. Need to reach out to the varStore. Can add accessors. But these are safe to access. In those cases we just make them public.
Hi @behdad - sorry to be so late responding to this, I've been out for a while (first PTO and then Covid)... trying to catch up on things. I tried a Firefox build with this applied, and can confirm that it appears to help. For a huge reflow (a 40MB text block) using the Apple system font, which is variable (but not very complex), it reduced the time spent under VariationDevice during GPOS pair-pos processing from around 500ms to 300ms. Obviously the specific gains will be depend on characteristics of the font being used, but in any case it's a nice win - thanks! |
Thanks @jfkthame |
Fixes issue originally raised in #2878 (comment)
Hi Jonathan,
Can you test this in Firefox and see if it helps with variable font performance?
Thanks