aboutsummaryrefslogtreecommitdiff
path: root/perf
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2023-06-30 08:48:43 -0600
committerBehdad Esfahbod <behdad@behdad.org>2023-06-30 08:48:43 -0600
commit547dc1a40ef6d83eb426afd1470bddf2b11bdfab (patch)
tree799644672d9c8420b43e40a95eccf51606731f20 /perf
parentfcf70af1349f2eeb9f58f67d2cc7d8e2c3ebf012 (diff)
downloadharfbuzz_ng-547dc1a40ef6d83eb426afd1470bddf2b11bdfab.tar.gz
[benchmark-font] Add load_face_and_shape benchmark
To measure face-loading performance
Diffstat (limited to 'perf')
-rw-r--r--perf/benchmark-font.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/perf/benchmark-font.cc b/perf/benchmark-font.cc
index e91b0a236..596acd8a0 100644
--- a/perf/benchmark-font.cc
+++ b/perf/benchmark-font.cc
@@ -42,6 +42,7 @@ enum operation_t
glyph_h_advances,
glyph_extents,
draw_glyph,
+ load_face_and_shape,
};
static void
@@ -168,6 +169,28 @@ static void BM_Font (benchmark::State &state,
hb_draw_funcs_destroy (draw_funcs);
break;
}
+ case load_face_and_shape:
+ {
+ for (auto _ : state)
+ {
+ hb_blob_t *blob = hb_blob_create_from_file_or_fail (test_input.font_path);
+ assert (blob);
+ hb_face_t *face = hb_face_create (blob, 0);
+ hb_blob_destroy (blob);
+ hb_font_t *font = hb_font_create (face);
+ hb_face_destroy (face);
+
+ hb_buffer_t *buffer = hb_buffer_create ();
+ hb_buffer_add_utf8 (buffer, " ", -1, 0, -1);
+ hb_buffer_guess_segment_properties (buffer);
+
+ hb_shape (font, buffer, nullptr, 0);
+
+ hb_buffer_destroy (buffer);
+ hb_font_destroy (font);
+ }
+ break;
+ }
}
@@ -235,6 +258,7 @@ int main(int argc, char** argv)
TEST_OPERATION (glyph_h_advances, benchmark::kMicrosecond);
TEST_OPERATION (glyph_extents, benchmark::kMicrosecond);
TEST_OPERATION (draw_glyph, benchmark::kMicrosecond);
+ TEST_OPERATION (load_face_and_shape, benchmark::kMicrosecond);
#undef TEST_OPERATION