Commit c1f4b57c064d41a291976e6d126f7bf0f6e66bc9

Behdad Esfahbod 2022-05-17T15:19:40

[ot-tags] Optimize language comparison Now that we know both strings are of equal len of 2 or 3, optimize. Part of https://github.com/harfbuzz/harfbuzz/issues/3591 Before: ------------------------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------ BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.50 ns 8.47 ns 81221549 BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 79.6 ns 79.3 ns 8785804 BM_hb_ot_tags_from_script_and_language/COMMON en_US 40.0 ns 39.9 ns 17462768 BM_hb_ot_tags_from_script_and_language/LATIN en_US 39.2 ns 39.1 ns 17886793 BM_hb_ot_tags_from_script_and_language/COMMON none 4.31 ns 4.30 ns 162805417 BM_hb_ot_tags_from_script_and_language/LATIN none 4.32 ns 4.31 ns 162656688 After: ------------------------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------ BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 8.27 ns 8.24 ns 81868701 BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 56.1 ns 56.0 ns 12353284 BM_hb_ot_tags_from_script_and_language/COMMON en_US 24.3 ns 24.2 ns 28955030 BM_hb_ot_tags_from_script_and_language/LATIN en_US 24.5 ns 24.4 ns 28664868 BM_hb_ot_tags_from_script_and_language/COMMON none 4.35 ns 4.34 ns 161190014 BM_hb_ot_tags_from_script_and_language/LATIN none 4.36 ns 4.34 ns 161319000