diff options
author | unknown <bar@bar.udmsearch.izhnet.ru> | 2002-07-31 13:25:37 +0500 |
---|---|---|
committer | unknown <bar@bar.udmsearch.izhnet.ru> | 2002-07-31 13:25:37 +0500 |
commit | 5d61c21aa9716544df6fce044ec27d8ce771c9d9 (patch) | |
tree | 6dd16cd69429579fdb86276d41f00220bdae6c87 | |
parent | 36e7a9d704ace8f6af6683e9fe521a8f3aea8102 (diff) | |
download | mariadb-git-5d61c21aa9716544df6fce044ec27d8ce771c9d9.tar.gz |
Some more speedup in charsets handling
sql/init.cc:
This code is moved to more proper place in mysys/charset.c
-rw-r--r-- | mysys/charset.c | 35 | ||||
-rw-r--r-- | sql/init.cc | 17 |
2 files changed, 24 insertions, 28 deletions
diff --git a/mysys/charset.c b/mysys/charset.c index cd84194dab1..c1a61ad693f 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -128,6 +128,24 @@ static my_bool read_charset_index(myf myflags) return FALSE; } +static void set_max_sort_char(CHARSET_INFO *cs) +{ + uchar max_char; + uint i; + + if (!cs->sort_order) + return; + + max_char=cs->sort_order[(uchar) cs->max_sort_char]; + for (i = 0; i < 256; i++) + { + if ((uchar) cs->sort_order[i] > max_char) + { + max_char=(uchar) cs->sort_order[i]; + cs->max_sort_char= (char) i; + } + } +} static my_bool init_available_charsets(myf myflags) { @@ -150,8 +168,10 @@ static my_bool init_available_charsets(myf myflags) /* Copy compiled charsets */ for (cs=compiled_charsets; cs->name; cs++) + { all_charsets[cs->number]=cs[0]; - + set_max_sort_char(&all_charsets[cs->number]); + } error = read_charset_index(myflags); charset_initialized=1; pthread_mutex_unlock(&THR_LOCK_charset); @@ -363,6 +383,8 @@ static CHARSET_INFO *add_charset(uint cs_number, myf flags) cs->mb_wc = my_mb_wc_8bit; cs->wc_mb = my_wc_mb_8bit; + set_max_sort_char(cs); + return cs; } @@ -404,19 +426,10 @@ static CHARSET_INFO *get_internal_charset(uint cs_number, myf flags) */ pthread_mutex_lock(&THR_LOCK_charset); - -/* - FIXME: it's faster to use this code, but max_sort_char is - not initialized here, so LIKE doesn't work later - cs = &all_charsets[cs_number]; if (!(cs->state & (MY_CS_COMPILED | MY_CS_LOADED))) cs=add_charset(cs_number, flags); -*/ - - if (!(cs=find_compiled_charset(cs_number))) - cs=add_charset(cs_number, flags); - + pthread_mutex_unlock(&THR_LOCK_charset); return cs; } diff --git a/sql/init.cc b/sql/init.cc index ac0ff701649..052ee16925e 100644 --- a/sql/init.cc +++ b/sql/init.cc @@ -53,23 +53,6 @@ void unireg_init(ulong options) } specialflag|=options; /* Set options from argv */ - // The following is needed because of like optimization in select.cc - - for (cs=compiled_charsets; cs->number; cs++) - { - uchar max_char; - if (!cs->sort_order) - continue; - max_char=cs->sort_order[(uchar) cs->max_sort_char]; - for (i = 0; i < 256; i++) - { - if ((uchar) cs->sort_order[i] > max_char) - { - max_char=(uchar) cs->sort_order[i]; - cs->max_sort_char= (char) i; - } - } - } thread_stack_min=thread_stack - STACK_MIN_SIZE; DBUG_VOID_RETURN; } |