harfbuzz/perf
Garret Rieger 5277a5772b [perf] Add benchmarks for CFF subsetting. 2022-05-10 12:16:44 -06:00
..
fonts [perf] Err. Remove HUGE font from perf suite 2022-04-21 13:51:37 -06:00
texts Rename HBGlyphID to HBGlyphID16 2021-09-19 16:30:12 -04:00
Makefile.am [perf/perf] Rename to benchmark-font 2022-05-02 13:41:49 -06:00
README.md [perf] Add missing ninja command in profiling instructions. 2022-04-21 11:16:12 -06:00
benchmark-font.cc [perf/benchmark-font] Add benchmark for glyph_h_advance 2022-05-02 16:59:48 -06:00
benchmark-map.cc [benchmark-map] Remove rand() overhead from benchmark 2022-04-29 13:14:41 -06:00
benchmark-set.cc [benchmark-set] Split SetLookup into an ordered and random version 2022-04-29 13:39:15 -06:00
benchmark-shape.cc [perf/benchmark-font] Parametrize test 2022-05-02 14:03:15 -06:00
benchmark-subset.cc [perf] Add benchmarks for CFF subsetting. 2022-05-10 12:16:44 -06:00
meson.build [perf/perf] Rename to benchmark-font 2022-05-02 13:41:49 -06:00
run.sh [perf] More rename 2019-12-10 12:43:42 -06:00

README.md

Building and Running

Benchmarks are implemented using Google Benchmark.

To build the benchmarks in this directory you need to set the benchmark option while configuring the build with meson:

meson configure build -Dbenchmark=enabled --buildtype=release

Then build the benchmark binaries with ninja:

ninja -Cbuild perf/benchmark-set

Finally, to run one of the benchmarks:

./build/perf/benchmark-set

It's possible to filter the benchmarks being run and customize the output via flags to the benchmark binary. See the Google Benchmark User Guide for more details.

Profiling

Configure the build to include debug information for profiling:

CXXFLAGS="-fno-omit-frame-pointer" meson --reconfigure build -Dbenchmark=enabled --buildtype=debug
ninja -Cbuild

Then run the benchmark with perf:

perf record -g -o ~/tmp/profiles/subset.prof ./build/perf/benchmark-subset --benchmark_filter="BM_subset_codepoints/subset_notocjk/100000" --benchmark_repetitions=5

You probably want to filter to a specific benchmark of interest and set the number of repititions high enough to get a good sampling of profile data.

Finally view the profile with:

perf report -i ~/tmp/profiles/subset.prof