2022-05-17 21:12:17 +02:00
|
|
|
/*
|
|
|
|
* Benchmarks for hb_set_t operations.
|
|
|
|
*/
|
|
|
|
#include "benchmark/benchmark.h"
|
|
|
|
|
|
|
|
#include "hb-ot.h"
|
|
|
|
|
|
|
|
static void BM_hb_ot_tags_from_script_and_language (benchmark::State& state,
|
|
|
|
hb_script_t script,
|
|
|
|
const char *language_str) {
|
|
|
|
|
|
|
|
hb_language_t language = hb_language_from_string (language_str, -1);
|
|
|
|
|
2022-05-18 00:34:52 +02:00
|
|
|
for (auto _ : state)
|
|
|
|
{
|
|
|
|
hb_tag_t script_tags[HB_OT_MAX_TAGS_PER_SCRIPT];
|
|
|
|
unsigned script_count = HB_OT_MAX_TAGS_PER_SCRIPT;
|
2022-05-17 21:12:17 +02:00
|
|
|
|
2022-05-18 00:34:52 +02:00
|
|
|
hb_tag_t language_tags[HB_OT_MAX_TAGS_PER_LANGUAGE];
|
|
|
|
unsigned language_count = HB_OT_MAX_TAGS_PER_LANGUAGE;
|
2022-05-17 21:12:17 +02:00
|
|
|
|
|
|
|
hb_ot_tags_from_script_and_language (script,
|
|
|
|
language,
|
|
|
|
&script_count /* IN/OUT */,
|
|
|
|
script_tags /* OUT */,
|
|
|
|
&language_count /* IN/OUT */,
|
|
|
|
language_tags /* OUT */);
|
|
|
|
}
|
|
|
|
}
|
2022-05-17 22:45:45 +02:00
|
|
|
BENCHMARK_CAPTURE (BM_hb_ot_tags_from_script_and_language, COMMON abcd_XY, HB_SCRIPT_COMMON, "abcd_XY");
|
2022-05-17 21:12:17 +02:00
|
|
|
BENCHMARK_CAPTURE (BM_hb_ot_tags_from_script_and_language, COMMON zh_CN, HB_SCRIPT_COMMON, "zh_CN");
|
|
|
|
BENCHMARK_CAPTURE (BM_hb_ot_tags_from_script_and_language, COMMON en_US, HB_SCRIPT_COMMON, "en_US");
|
|
|
|
BENCHMARK_CAPTURE (BM_hb_ot_tags_from_script_and_language, LATIN en_US, HB_SCRIPT_LATIN, "en_US");
|
|
|
|
BENCHMARK_CAPTURE (BM_hb_ot_tags_from_script_and_language, COMMON none, HB_SCRIPT_LATIN, nullptr);
|
|
|
|
BENCHMARK_CAPTURE (BM_hb_ot_tags_from_script_and_language, LATIN none, HB_SCRIPT_LATIN, nullptr);
|
|
|
|
|
|
|
|
BENCHMARK_MAIN();
|