-
Notifications
You must be signed in to change notification settings - Fork 630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ot-tags] Avoid strcmp in hb_ot_tags_from_language #3592
Conversation
And this is already redundant. Oh well. I think I will stop thinking about performance till I am sure you are done making changes. |
Can you check again with master? I removed the strcmp's already. |
Namely: 909f00a |
I believe I'm done. :) |
benchmark-ot, before: ------------------------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------ BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 14.1 ns 14.1 ns 46055359 BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 81.8 ns 81.7 ns 8543566 BM_hb_ot_tags_from_script_and_language/COMMON en_US 32.4 ns 32.3 ns 21148356 BM_hb_ot_tags_from_script_and_language/LATIN en_US 32.5 ns 32.4 ns 21519987 BM_hb_ot_tags_from_script_and_language/COMMON none 6.60 ns 6.60 ns 104238020 BM_hb_ot_tags_from_script_and_language/LATIN none 6.68 ns 6.67 ns 102315248 After: ------------------------------------------------------------------------------------------------ Benchmark Time CPU Iterations ------------------------------------------------------------------------------------------------ BM_hb_ot_tags_from_script_and_language/COMMON abcd_XY 14.0 ns 14.0 ns 48500637 BM_hb_ot_tags_from_script_and_language/COMMON zh_CN 81.1 ns 80.9 ns 8687343 BM_hb_ot_tags_from_script_and_language/COMMON en_US 34.2 ns 34.1 ns 20483588 BM_hb_ot_tags_from_script_and_language/LATIN en_US 34.2 ns 34.1 ns 20876827 BM_hb_ot_tags_from_script_and_language/COMMON none 6.77 ns 6.75 ns 101890802 BM_hb_ot_tags_from_script_and_language/LATIN none 6.73 ns 6.72 ns 102786996
@@ -217,6 +217,8 @@ lang_matches (const char *lang_str, const char *limit, const char *spec, unsigne | |||
struct LangTag | |||
{ | |||
hb_tag_t language; | |||
unsigned int idx_for_same_tag; | |||
unsigned int total_for_same_tag; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint16_t
please.
A bit wasteful. Let me see the numbers and decide. Trying it now. Thanks. |
Size increase is 5.5kb and there's no measurable time improvement. I'd abandon. |
I thought of this while reviewing #3591. I don’t know whether the speed improvement is worth the extra space from
LangTag
’s two new fields.