mooman219 / fontdue

The fastest font renderer in the world, written in pure rust.
Apache License 2.0
1.44k stars 72 forks source link

Slight layout performance regression #149

Open bschwind opened 10 months ago

bschwind commented 10 months ago

After adding some benchmarks to my own application, I noticed a small performance regression when updating fontdue from 0.4 to 0.8. This has to do with text layout (I haven't benched other functionality)

I did a git bisect and found the likely culprit:

Good commit results

layout/fontdue/100      time:   [2.8446 µs 2.8492 µs 2.8541 µs]                                
                        change: [-18.847% -18.487% -18.101%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 36 outliers among 250 measurements (14.40%)
  14 (5.60%) high mild
  22 (8.80%) high severe
layout/fontdue/500      time:   [15.441 µs 15.471 µs 15.504 µs]                                
                        change: [-19.661% -18.781% -18.065%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 24 outliers among 250 measurements (9.60%)
  20 (8.00%) high mild
  4 (1.60%) high severe
layout/fontdue/1000     time:   [32.280 µs 32.336 µs 32.399 µs]                                 
                        change: [-18.030% -17.843% -17.655%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 24 outliers among 250 measurements (9.60%)
  7 (2.80%) high mild
  17 (6.80%) high severe

Bad commit results

layout/fontdue/100      time:   [3.5236 µs 3.5302 µs 3.5375 µs]                                
                        change: [+22.206% +22.751% +23.257%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 20 outliers among 250 measurements (8.00%)
  12 (4.80%) high mild
  8 (3.20%) high severe
layout/fontdue/500      time:   [18.886 µs 18.907 µs 18.930 µs]                                
                        change: [+22.081% +22.431% +22.782%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 45 outliers among 250 measurements (18.00%)
  31 (12.40%) high mild
  14 (5.60%) high severe
layout/fontdue/1000     time:   [39.052 µs 39.108 µs 39.167 µs]                                 
                        change: [+20.672% +20.872% +21.070%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 28 outliers among 250 measurements (11.20%)
  3 (1.20%) low mild
  6 (2.40%) high mild
  19 (7.60%) high severe

Unfortunately, the "bad" commit is just updating the hashbrown dependency, so I'm not sure if there's much we can do.