Skip to content

[ttx_diff] Add --timings flag, print fn runtimes#1940

Merged
cmyr merged 1 commit intomainfrom
ttxdiff-perf
Apr 8, 2026
Merged

[ttx_diff] Add --timings flag, print fn runtimes#1940
cmyr merged 1 commit intomainfrom
ttxdiff-perf

Conversation

@cmyr
Copy link
Copy Markdown
Member

@cmyr cmyr commented Apr 8, 2026

speculative, we mentioned this a while ago and I got nerd-sniped.

for the example included below, we're spending lots of time in name_id_to_name. In rubik, we're spending lots of time normalizing off-by-ones.


This makes it easier to diagnose where exactly ttx_diff itself is spending time. Output looks like this:

TIMINGS
  0.658s  build fontc
  35.915s  build fontmake
  17.134s  ttx fontc
  17.053s  ttx fontmake
  0.443s  normalize fontc gpos
  0.314s  normalize fontmake gpos
  0.004s  normalize fontc gdef
  0.003s  normalize fontmake gdef
  1.142s  fill_in_gvar_deltas
  53.099s  reduce_diff_noise
    1.665s  sort indices
    13.976s  name id to name
    1.596s  gdef work
    14.911s  name id to name
    1.024s  gdef work
    3.007s  normalize glyf contours
    3.556s  normalize gvar contours
    7.455s  allow off-by-ones
  5.949s  extract_comparables fontc
  4.342s  extract_comparables fontmake
  0.332s  check_sizes
  2m29.088s  total

@wmedrano
Copy link
Copy Markdown
Contributor

wmedrano commented Apr 8, 2026

speculative, we mentioned this a while ago and I got nerd-sniped.

I'm so sorry Colin

lgtm, some lint errors need fixing on the Python side

This makes it easier to diagnose where exactly ttx_diff itself is
spending time. Output looks like this:

TIMINGS
  0.658s  build fontc
  35.915s  build fontmake
  17.134s  ttx fontc
  17.053s  ttx fontmake
  0.443s  normalize fontc gpos
  0.314s  normalize fontmake gpos
  0.004s  normalize fontc gdef
  0.003s  normalize fontmake gdef
  1.142s  fill_in_gvar_deltas
  53.099s  reduce_diff_noise
    1.665s  sort indices
    13.976s  name id to name
    1.596s  gdef work
    14.911s  name id to name
    1.024s  gdef work
    3.007s  normalize glyf contours
    3.556s  normalize gvar contours
    7.455s  allow off-by-ones
  5.949s  extract_comparables fontc
  4.342s  extract_comparables fontmake
  0.332s  check_sizes
  2m29.088s  total
@cmyr
Copy link
Copy Markdown
Member Author

cmyr commented Apr 8, 2026

speculative, we mentioned this a while ago and I got nerd-sniped.

I'm so sorry Colin

lgtm, some lint errors need fixing on the Python side

No apologies necessary! I wouldn't have expected the off-by-ones to be such a slow operation, neat to be able to see that clearly.

@rsheeter
Copy link
Copy Markdown
Contributor

rsheeter commented Apr 8, 2026

In rubik, we're spending lots of time normalizing off-by-ones.

Worth citing #1932 which observes "Most of the time seems to be in ttx_diff in allow_some_off_by_ones"

@rsheeter
Copy link
Copy Markdown
Contributor

rsheeter commented Apr 8, 2026

(I'm pretty sure I wrote allow_some_off_by_ones off the cuff with a focus on v.simple outlines so it's not surprising there are fonts that it handles poorly)

@cmyr cmyr added this pull request to the merge queue Apr 8, 2026
Merged via the queue into main with commit 2888231 Apr 8, 2026
8 checks passed
@cmyr cmyr deleted the ttxdiff-perf branch April 8, 2026 20:15
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.

3 participants