From 636c90e81c2eb9a907a1c14d0f3450902d95f65a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 2 May 2022 13:41:49 -0600 Subject: [PATCH] [perf/perf] Rename to benchmark-font --- perf/Makefile.am | 3 +- perf/{perf-draw.hh => benchmark-font.cc} | 0 perf/meson.build | 7 ++- perf/perf-extents.hh | 65 ------------------------ perf/perf.cc | 3 -- 5 files changed, 4 insertions(+), 74 deletions(-) rename perf/{perf-draw.hh => benchmark-font.cc} (100%) delete mode 100644 perf/perf-extents.hh delete mode 100644 perf/perf.cc diff --git a/perf/Makefile.am b/perf/Makefile.am index 9d5ed6791..78ca3bafb 100644 --- a/perf/Makefile.am +++ b/perf/Makefile.am @@ -6,8 +6,7 @@ SUBDIRS = EXTRA_DIST += meson.build \ - perf-draw.hh \ - perf.cc \ + benchmark-font.cc \ benchmark-map.cc \ benchmark-set.cc \ benchmark-shape.cc \ diff --git a/perf/perf-draw.hh b/perf/benchmark-font.cc similarity index 100% rename from perf/perf-draw.hh rename to perf/benchmark-font.cc diff --git a/perf/meson.build b/perf/meson.build index bca43e13b..93d7b4d7c 100644 --- a/perf/meson.build +++ b/perf/meson.build @@ -1,7 +1,7 @@ google_benchmark = subproject('google-benchmark') google_benchmark_dep = google_benchmark.get_variable('google_benchmark_dep') -benchmark('perf', executable('perf', 'perf.cc', +benchmark('benchmark-font', executable('benchmark-font', 'benchmark-font.cc', dependencies: [ google_benchmark_dep, freetype_dep, ], @@ -11,8 +11,7 @@ benchmark('perf', executable('perf', 'perf.cc', install: false, ), workdir: meson.current_source_dir() / '..', timeout: 100) - -benchmark('benchmark-shape', executable('benchmark-shape', 'benchmark-shape.cc', +benchmark('benchmark-map', executable('benchmark-map', 'benchmark-map.cc', dependencies: [ google_benchmark_dep, ], @@ -32,7 +31,7 @@ benchmark('benchmark-set', executable('benchmark-set', 'benchmark-set.cc', install: false, ), workdir: meson.current_source_dir() / '..', timeout: 100) -benchmark('benchmark-map', executable('benchmark-map', 'benchmark-map.cc', +benchmark('benchmark-shape', executable('benchmark-shape', 'benchmark-shape.cc', dependencies: [ google_benchmark_dep, ], diff --git a/perf/perf-extents.hh b/perf/perf-extents.hh deleted file mode 100644 index 4abe841c4..000000000 --- a/perf/perf-extents.hh +++ /dev/null @@ -1,65 +0,0 @@ -#include "benchmark/benchmark.h" - -#include "hb.h" -#include "hb-ft.h" -#include "hb-ot.h" - -static void extents (benchmark::State &state, const char *font_path, bool is_var, backend_t backend) -{ - hb_font_t *font; - unsigned num_glyphs; - { - hb_blob_t *blob = hb_blob_create_from_file_or_fail (font_path); - assert (blob); - hb_face_t *face = hb_face_create (blob, 0); - hb_blob_destroy (blob); - num_glyphs = hb_face_get_glyph_count (face); - font = hb_font_create (face); - hb_face_destroy (face); - } - - if (is_var) - { - hb_variation_t wght = {HB_TAG ('w','g','h','t'), 500}; - hb_font_set_variations (font, &wght, 1); - } - - if (backend == FREETYPE) - { - hb_ft_font_set_funcs (font); - hb_ft_font_set_load_flags (font, FT_LOAD_NO_HINTING | FT_LOAD_NO_SCALE); - } - - hb_glyph_extents_t extents; - for (auto _ : state) - for (unsigned gid = 0; gid < num_glyphs; ++gid) - hb_font_get_glyph_extents (font, gid, &extents); - - hb_font_destroy (font); -} - -#define FONT_BASE_PATH "test/subset/data/fonts/" - -BENCHMARK_CAPTURE (extents, cff - ot - SourceSansPro, FONT_BASE_PATH "SourceSansPro-Regular.otf", false, HARFBUZZ); -BENCHMARK_CAPTURE (extents, cff - ft - SourceSansPro, FONT_BASE_PATH "SourceSansPro-Regular.otf", false, FREETYPE); - -BENCHMARK_CAPTURE (extents, cff2 - ot - AdobeVFPrototype, FONT_BASE_PATH "AdobeVFPrototype.otf", false, HARFBUZZ); -BENCHMARK_CAPTURE (extents, cff2 - ft - AdobeVFPrototype, FONT_BASE_PATH "AdobeVFPrototype.otf", false, FREETYPE); - -BENCHMARK_CAPTURE (extents, cff2/vf - ot - AdobeVFPrototype, FONT_BASE_PATH "AdobeVFPrototype.otf", true, HARFBUZZ); -BENCHMARK_CAPTURE (extents, cff2/vf - ft - AdobeVFPrototype, FONT_BASE_PATH "AdobeVFPrototype.otf", true, FREETYPE); - -BENCHMARK_CAPTURE (extents, glyf - ot - SourceSerifVariable, FONT_BASE_PATH "SourceSerifVariable-Roman.ttf", false, HARFBUZZ); -BENCHMARK_CAPTURE (extents, glyf - ft - SourceSerifVariable, FONT_BASE_PATH "SourceSerifVariable-Roman.ttf", false, FREETYPE); - -BENCHMARK_CAPTURE (extents, glyf/vf - ot - SourceSerifVariable, FONT_BASE_PATH "SourceSerifVariable-Roman.ttf", true, HARFBUZZ); -BENCHMARK_CAPTURE (extents, glyf/vf - ft - SourceSerifVariable, FONT_BASE_PATH "SourceSerifVariable-Roman.ttf", true, FREETYPE); - -BENCHMARK_CAPTURE (extents, glyf - ot - Comfortaa, FONT_BASE_PATH "Comfortaa-Regular-new.ttf", false, HARFBUZZ); -BENCHMARK_CAPTURE (extents, glyf - ft - Comfortaa, FONT_BASE_PATH "Comfortaa-Regular-new.ttf", false, FREETYPE); - -BENCHMARK_CAPTURE (extents, glyf/vf - ot - Comfortaa, FONT_BASE_PATH "Comfortaa-Regular-new.ttf", true, HARFBUZZ); -BENCHMARK_CAPTURE (extents, glyf/vf - ft - Comfortaa, FONT_BASE_PATH "Comfortaa-Regular-new.ttf", true, FREETYPE); - -BENCHMARK_CAPTURE (extents, glyf - ot - Roboto, FONT_BASE_PATH "Roboto-Regular.ttf", false, HARFBUZZ); -BENCHMARK_CAPTURE (extents, glyf - ft - Roboto, FONT_BASE_PATH "Roboto-Regular.ttf", false, FREETYPE); diff --git a/perf/perf.cc b/perf/perf.cc deleted file mode 100644 index 2c5cad85b..000000000 --- a/perf/perf.cc +++ /dev/null @@ -1,3 +0,0 @@ - -#include "perf-draw.hh" -