fontations icon indicating copy to clipboard operation
fontations copied to clipboard

HB Benchmark

Open rsheeter opened this issue 2 years ago • 1 comments

Refs courtesy of @behdad:

Write the equivalent of hb-ft or hb-ot-font using fontations. That would allow shaping on top of it as well.

  • https://github.com/harfbuzz/harfbuzz/blob/main/src/hb-ft.cc
  • https://github.com/harfbuzz/harfbuzz/blob/main/src/hb-ot-font.cc

Should enable benchmarking against HB. To actually run benchmark:

$ meson build -Dbenchmark=enabled
$ ninja
$ build/perf/benchmark-font

rsheeter avatar Jun 27 '23 18:06 rsheeter

For example, here's the output of $ ninja -Cbuild && perf record build/perf/benchmark-font --benchmark_filter=draw_glyph:

--------------------------------------------------------------------------------------------------
Benchmark                                                        Time             CPU   Iterations
--------------------------------------------------------------------------------------------------
BM_Font/draw_glyph/Roboto-Regular.ttf/hb                       534 us          533 us         1326
BM_Font/draw_glyph/Roboto-Regular.ttf/ft                       706 us          704 us          996
BM_Font/draw_glyph/RobotoFlex-Variable.ttf/hb                  401 us          400 us         1772
BM_Font/draw_glyph/RobotoFlex-Variable.ttf/ft                  523 us          521 us         1244
BM_Font/draw_glyph/RobotoFlex-Variable.ttf/var/hb             1553 us         1548 us          457
BM_Font/draw_glyph/RobotoFlex-Variable.ttf/var/ft             2721 us         2713 us          258
BM_Font/draw_glyph/SourceSansPro-Regular.otf/hb               1417 us         1414 us          498
BM_Font/draw_glyph/SourceSansPro-Regular.otf/ft               4219 us         4209 us          166
BM_Font/draw_glyph/AdobeVFPrototype.otf/hb                     971 us          969 us          723
BM_Font/draw_glyph/AdobeVFPrototype.otf/ft                    1226 us         1223 us          572
BM_Font/draw_glyph/AdobeVFPrototype.otf/var/hb                1008 us         1005 us          696
BM_Font/draw_glyph/AdobeVFPrototype.otf/var/ft                1239 us         1236 us          566
BM_Font/draw_glyph/SourceSerifVariable-Roman.ttf/hb            921 us          918 us          761
BM_Font/draw_glyph/SourceSerifVariable-Roman.ttf/ft           1124 us         1122 us          626
BM_Font/draw_glyph/SourceSerifVariable-Roman.ttf/var/hb       1404 us         1400 us          501
BM_Font/draw_glyph/SourceSerifVariable-Roman.ttf/var/ft       2493 us         2486 us          282
BM_Font/draw_glyph/Comfortaa-Regular-new.ttf/hb                551 us          550 us         1273
BM_Font/draw_glyph/Comfortaa-Regular-new.ttf/ft                676 us          675 us         1041
BM_Font/draw_glyph/NotoNastaliqUrdu-Regular.ttf/hb             737 us          735 us          941
BM_Font/draw_glyph/NotoNastaliqUrdu-Regular.ttf/ft             912 us          910 us          776
BM_Font/draw_glyph/NotoSerifMyanmar-Regular.otf/hb             801 us          799 us          894
BM_Font/draw_glyph/NotoSerifMyanmar-Regular.otf/ft            1857 us         1852 us          378

behdad avatar Jun 27 '23 18:06 behdad