WL#5230: Replace strcasecmp() used for checking equality to a more efficient function
Affects: Server-6.0 — Status: Un-Assigned — Priority: Medium
In /sql/*.cc we can find this style calls checking equality throughout the code: if (!my_strcasecmp(s1->str, s2->str)) where s1 and s2 are of type LEX_STRING. All of those calls can be faster if there is a check for string lengths prior to doing the comparison: if (s1->len != s2->len || !my_strcasecmp(s1->str, s2->str)) These two conditions should go into a separate inline function, or into a macros, say lex_string_equal(), so the final calls will look about like this: if (lex_string_equal(s1, s2)) Note, this optimization can be done only for "simple" collations which only have "one character -> one weight" rules. This optimization can NOT be done for "complex" collations having expansions ("one to many") or contractions ("many to one"). As system_charset_info does not have these "complexities", and most of the calls in /sql/*.cc is done for system_charset_info values, this task can possibly give good overall performance improvement. Also 'my_strncasecmp(...) == 0' notation is now used in other places, making search for string comparisons harder. So another advantage of this task is to make all comparison look in the same style. References ========== BUG#49501 Inefficient information_schema check (system collation)
Copyright (c) 2000, 2018, Oracle Corporation and/or its affiliates. All rights reserved.