[perf/benchmark-ot] Fix benchmark

Part of https://github.com/harfbuzz/harfbuzz/issues/3591

Ouch!

These are the current numbers:

------------------------------------------------------------------------------------------------
Benchmark                                                      Time             CPU   Iterations
------------------------------------------------------------------------------------------------
BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY       78.0 ns         77.7 ns      8917912
BM_hb_ot_tags_from_script_and_language/COMMON zh_CN         44.9 ns         44.8 ns     15475318
BM_hb_ot_tags_from_script_and_language/COMMON en_US         17.6 ns         17.5 ns     39812340
BM_hb_ot_tags_from_script_and_language/LATIN en_US          18.2 ns         18.1 ns     38356204
BM_hb_ot_tags_from_script_and_language/COMMON none          4.76 ns         4.74 ns    148746131
BM_hb_ot_tags_from_script_and_language/LATIN none           4.73 ns         4.71 ns    148421349
This commit is contained in:
Behdad Esfahbod 2022-05-17 16:34:52 -06:00
parent dfca47f419
commit 0ff5d36cd4
1 changed files with 6 additions and 5 deletions

View File

@ -11,13 +11,14 @@ static void BM_hb_ot_tags_from_script_and_language (benchmark::State& state,
hb_language_t language = hb_language_from_string (language_str, -1);
hb_tag_t script_tags[HB_OT_MAX_TAGS_PER_SCRIPT];
unsigned script_count = HB_OT_MAX_TAGS_PER_SCRIPT;
for (auto _ : state)
{
hb_tag_t script_tags[HB_OT_MAX_TAGS_PER_SCRIPT];
unsigned script_count = HB_OT_MAX_TAGS_PER_SCRIPT;
hb_tag_t language_tags[HB_OT_MAX_TAGS_PER_LANGUAGE];
unsigned language_count = HB_OT_MAX_TAGS_PER_LANGUAGE;
hb_tag_t language_tags[HB_OT_MAX_TAGS_PER_LANGUAGE];
unsigned language_count = HB_OT_MAX_TAGS_PER_LANGUAGE;
for (auto _ : state) {
hb_ot_tags_from_script_and_language (script,
language,
&script_count /* IN/OUT */,