This builds one benchmark-harf executable containing the shaping benchmark
twice: once against HarfBuzz's <hb.h> API and once against HarfRust's
<hr-hb.h> compatibility API. The HarfBuzz compilation registers its native
OpenType/AAT shaper and, when available, its built-in HarfRust shaper. The output
suffixes are:
hb: HarfBuzz's native OpenType/AAT shaperhr: HarfRust through its C APIhb-hr: HarfRust through HarfBuzz's shaper integration
The default paths expect release builds in ~/hb/build and
~/hr/target/release. Configure and build with:
meson setup build
meson compile -C buildRun the default workload corpus with:
./build/benchmark-harfThe default workloads also include these optional local AAT collections when they are present in the configured HarfBuzz source directory:
| Font collection | Text from hb_root/perf/texts/ |
|---|---|
LucidaGrande.ttc |
en-thelittleprince.txt |
Menlo.ttc |
en-thelittleprince.txt |
GeezaPro.ttc |
fa-thelittleprince.txt |
Devanagari Sangam MN.ttc |
hi-words.txt |
These fonts are not included or copied into this project. Both engines support AAT. Each collection uses face 0, like other font inputs. To use copies in a different directory:
./build/benchmark-harf --aat-font-dir "$HOME/hb"As with HarfBuzz's perf/benchmark-shape, custom inputs are font/text pairs:
./build/benchmark-harf font.ttf text.txt \
--benchmark_min_time=.1s --benchmark_repetitions=5Custom font/text pairs replace all default workloads, including the optional AAT collections. Missing optional AAT fonts are skipped.
The HarfBuzz, HarfBuzz build, HarfRust, and HarfRust build paths can be overridden at setup time:
meson setup build \
-Dhb_root=/path/to/harfbuzz \
-Dhb_build=/path/to/harfbuzz/build \
-Dhr_root=/path/to/harfrust \
-Dhr_build=/path/to/harfrust/target/releaseTango compares two warmed shaping workloads on the same runner. Each worker has its own executable, engine library, font and buffer. Both use the same C++ shaping loop as the Google Benchmark executable. A sample measures one pass through the newline-delimited corpus. Font loading and warm-up happen before timing.
The workers link to release libraries built at optimization level 3 with LTO. For HarfBuzz, the script enables Meson’s LTO option. HarfRust sets fat LTO in its workspace release profile.
On Linux, build a worker for each source revision you want to compare. Use a separate output directory per revision so each executable loads its own library. For example, to compare two HarfBuzz revisions:
tango/build-engine.sh hb /path/to/harfbuzz-base /tmp/hb-base
tango/build-engine.sh hb /path/to/harfbuzz-pr /tmp/hb-pr
HARF_FONT=/path/to/font.ttf HARF_TEXT=/path/to/text.txt \
/tmp/hb-pr/tango/release/benchmark-harf-tango compare \
/tmp/hb-base/tango/release/benchmark-harf-tango --time 5Use hr for two HarfRust revisions, or compare an hr candidate with an
hb baseline. Both workers inherit the same HARF_FONT, HARF_TEXT and
optional HARF_DIRECTION and HARF_VARIATIONS. End each line with a newline.
The GitHub action takes engine (hb or hr), baseline, and candidate
(full commit SHAs). Use the PR base SHA and its test merge SHA to measure the
change on top of the current base. Equal SHAs run an A/A control using the same
built executable in both workers.
Set peer-ref: main to also compare the same candidate build with the other
engine. The action checks out that branch once per run and links to the exact
commits in each result table. To reproduce a cross-engine comparison, pass the
recorded peer SHA in place of main. The baseline column is the PR base in the
first table and the other engine in the second. A positive difference means
the candidate took longer.
Both comparisons use the same pinned corpus. They run three five-second trials
each for Roboto with English prose, Amiri with Persian prose, Source Serif
Variable with react-dom.txt, and Noto Nastaliq Urdu with Persian prose and a
Persian word list. The Actions summary shows each trial. The artifact contains
the tables and raw paired samples for each comparison. Measured slowdowns are
informational. Build, shaping and measurement failures fail the job.