summaryrefslogtreecommitdiff
path: root/strings/ctype-gb2312.c
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-07-20 19:26:31 +0300
committerMonty <monty@mariadb.org>2020-07-23 10:54:33 +0300
commitdbcd3384e0799ee99a966edaff2c0f135ef51a29 (patch)
tree9beee5052a706dd721c044edf0de971f868d15e3 /strings/ctype-gb2312.c
parent46ffd47f422147cd748119eba19ad248bd7356db (diff)
downloadmariadb-git-dbcd3384e0799ee99a966edaff2c0f135ef51a29.tar.gz
MDEV-7947 strcmp() takes 0.37% in OLTP RO
This patch ensures that all identical character sets shares the same cs->csname. This allows us to replace strcmp() in my_charset_same() with comparisons of pointers. This fixes a long standing performance issue that could cause as strcmp() for every item sent trough the protocol class to the end user. One consequence of this patch is that we don't allow one to add a character definition in the Index.xml file that changes the csname of an existing character set. This is by design as changing character set names of existing ones is extremely dangerous, especially as some storage engines just records character set numbers. As we now have a hash over character set's csname, we can in the future use that for faster access to a specific character set. This could be done by changing the hash to non unique and use the hash to find the next character set with same csname.
Diffstat (limited to 'strings/ctype-gb2312.c')
-rw-r--r--strings/ctype-gb2312.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c
index 266799f32a3..91ee2504b65 100644
--- a/strings/ctype-gb2312.c
+++ b/strings/ctype-gb2312.c
@@ -29,6 +29,8 @@
#ifdef HAVE_CHARSET_gb2312
+const char charset_name_gb2312[]= "gb2312";
+
static const uchar ctype_gb2312[257] =
{
0, /* For standard library */
@@ -6459,7 +6461,7 @@ struct charset_info_st my_charset_gb2312_chinese_ci=
{
24,0,0, /* number */
MY_CS_COMPILED|MY_CS_PRIMARY, /* state */
- "gb2312", /* cs name */
+ charset_name_gb2312, /* cs name */
"gb2312_chinese_ci",/* name */
"", /* comment */
NULL, /* tailoring */
@@ -6492,7 +6494,7 @@ struct charset_info_st my_charset_gb2312_bin=
{
86,0,0, /* number */
MY_CS_COMPILED|MY_CS_BINSORT, /* state */
- "gb2312", /* cs name */
+ charset_name_gb2312, /* cs name */
"gb2312_bin", /* name */
"", /* comment */
NULL, /* tailoring */
@@ -6525,7 +6527,7 @@ struct charset_info_st my_charset_gb2312_chinese_nopad_ci=
{
MY_NOPAD_ID(24),0,0,/* number */
MY_CS_COMPILED|MY_CS_NOPAD, /* state */
- "gb2312", /* cs name */
+ charset_name_gb2312, /* cs name */
"gb2312_chinese_nopad_ci",/* name */
"", /* comment */
NULL, /* tailoring */
@@ -6558,7 +6560,7 @@ struct charset_info_st my_charset_gb2312_nopad_bin=
{
MY_NOPAD_ID(86),0,0,/* number */
MY_CS_COMPILED|MY_CS_BINSORT|MY_CS_NOPAD, /* state */
- "gb2312", /* cs name */
+ charset_name_gb2312, /* cs name */
"gb2312_nopad_bin", /* name */
"", /* comment */
NULL, /* tailoring */