Skip to content
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

Upgrade owned_ttf_parser to 0.13.2 + pre-parse subtables #48

Merged
merged 5 commits into from
Nov 6, 2021

Conversation

alexheretic
Copy link
Owner

@alexheretic alexheretic commented Oct 28, 2021

During the update to 0.13 I noticed performance regressions with glyph_index & kern due to the ttf-parser refactor. However, these lead to deeper discoveries that each call was causing subtables to be parsed per-call (ultimately as ttf-parser avoids all allocation).

I've now upgraded owned_ttf_parser crate with the ability to pre-parse these subtables. This PR uses that ability to provide much faster layout performance.

Bench comparisons with the current verson

Layout scenario benches are ~25-30% faster.

method:Font::glyph_id   time:   [7.3043 ns 7.3158 ns 7.3305 ns]                                   
                        change: [-19.916% -19.790% -19.629%] (p = 0.00 < 0.05)
                        Performance has improved.

method:Font::h_advance  time:   [1.8667 ns 1.8675 ns 1.8683 ns]                                    
                        change: [+7.0229% +7.1406% +7.2498%] (p = 0.00 < 0.05)
                        Performance has regressed.

method:Font::kern_unscaled                                                                            
                        time:   [20.317 ns 20.330 ns 20.342 ns]
                        change: [-24.466% -24.390% -24.320%] (p = 0.00 < 0.05)
                        Performance has improved.

layout_a_sentence       time:   [8.9906 us 8.9937 us 8.9967 us]                               
                        change: [-29.529% -29.458% -29.392%] (p = 0.00 < 0.05)
                        Performance has improved.

layout_a_sentence (FontVec::try_from_vec)                                                                             
                        time:   [9.2754 us 9.2851 us 9.2944 us]
                        change: [-31.906% -31.834% -31.760%] (p = 0.00 < 0.05)
                        Performance has improved.

layout_a_sentence (FontArc::try_from_slice)                                                                             
                        time:   [10.932 us 10.939 us 10.946 us]
                        change: [-26.263% -26.136% -26.037%] (p = 0.00 < 0.05)
                        Performance has improved.

layout_a_sentence (exo2-otf)                                                                             
                        time:   [5.3666 us 5.3691 us 5.3719 us]
                        change: [-26.890% -26.827% -26.756%] (p = 0.00 < 0.05)
                        Performance has improved.

layout_a_sentence (exo2-ttf)                                                                             
                        time:   [5.1529 us 5.1564 us 5.1601 us]
                        change: [-30.747% -30.648% -30.499%] (p = 0.00 < 0.05)
                        Performance has improved.

@alexheretic alexheretic marked this pull request as ready for review November 2, 2021 00:26
@alexheretic alexheretic changed the title Upgrate to ttf-parser 0.13 Add GlyphIdentifier & Kerner + upgrate to ttf-parser 0.13 Nov 2, 2021
@alexheretic
Copy link
Owner Author

alexheretic commented Nov 2, 2021

The other option is to have owned-ttf-parser provide the ability to pre-parse and store these subtables alongside the font itself.

Update: I did this :)

@alexheretic alexheretic changed the title Add GlyphIdentifier & Kerner + upgrate to ttf-parser 0.13 Upgrade owned_ttf_parser to 0.13.2 + pre-parse subtables Nov 6, 2021
@alexheretic alexheretic merged commit 0841e49 into master Nov 6, 2021
@alexheretic alexheretic deleted the ttfp-0.13 branch November 6, 2021 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant