summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <bar@bar.mysql.r18.ru>2002-08-15 16:42:54 +0500
committerunknown <bar@bar.mysql.r18.ru>2002-08-15 16:42:54 +0500
commitbf5b046e841121c4250bd668449df99302de31ea (patch)
tree0771a890e5d8ed36e182ce6069988f32b9db0bc7 /mysys
parent6cc0d7d7e8d8321ecd2d918cb0e3160eb0322ecd (diff)
downloadmariadb-git-bf5b046e841121c4250bd668449df99302de31ea.tar.gz
Some speed improvements
Diffstat (limited to 'mysys')
-rw-r--r--mysys/hash.c4
-rw-r--r--mysys/mf_casecnv.c17
-rw-r--r--mysys/mf_soundex.c3
3 files changed, 15 insertions, 9 deletions
diff --git a/mysys/hash.c b/mysys/hash.c
index 0cbd14607f6..7fb634a05b9 100644
--- a/mysys/hash.c
+++ b/mysys/hash.c
@@ -136,10 +136,12 @@ static uint calc_hashnr(CHARSET_INFO *cs __attribute__((unused)),
static uint calc_hashnr_caseup(CHARSET_INFO *cs, const byte *key,uint length)
{
register uint nr=1, nr2=4;
+ register uchar *map=cs->to_upper;
+
while (length--)
{
nr^= (((nr & 63)+nr2)*
- ((uint) (uchar) my_toupper(cs, *key++)))+ (nr << 8);
+ ((uint) (uchar) map[(uchar)*key++])) + (nr << 8);
nr2+=3;
}
return((uint) nr);
diff --git a/mysys/mf_casecnv.c b/mysys/mf_casecnv.c
index 510a9b08f76..631db18b1ed 100644
--- a/mysys/mf_casecnv.c
+++ b/mysys/mf_casecnv.c
@@ -33,8 +33,10 @@
void case_sort(CHARSET_INFO *cs, my_string str, uint length)
{
+ register uchar *map=cs->sort_order;
+
for ( ; length>0 ; length--, str++)
- *str= (char) cs->sort_order[(uchar) *str];
+ *str= (char) map[(uchar) *str];
} /* case_sort */
@@ -46,11 +48,11 @@ int my_sortcmp(CHARSET_INFO *cs, const char *s, const char *t, uint len)
else
#endif
{
+ register uchar *map=cs->sort_order;
while (len--)
{
- if (cs->sort_order[(uchar) *s++] != cs->sort_order[(uchar) *t++])
- return ((int) cs->sort_order[(uchar) s[-1]] -
- (int) cs->sort_order[(uchar) t[-1]]);
+ if (map[(uchar) *s++] != map[(uchar) *t++])
+ return ((int) map[(uchar) s[-1]] - (int) map[(uchar) t[-1]]);
}
return 0;
}
@@ -67,11 +69,12 @@ int my_sortncmp(CHARSET_INFO *cs,
#endif
{
uint len= min(s_len,t_len);
+ register uchar *map=cs->sort_order;
+
while (len--)
{
- if (cs->sort_order[(uchar) *s++] != cs->sort_order[(uchar) *t++])
- return ((int) cs->sort_order[(uchar) s[-1]] -
- (int) cs->sort_order[(uchar) t[-1]]);
+ if (map[(uchar) *s++] != map[(uchar) *t++])
+ return ((int) map[(uchar) s[-1]] - (int) map[(uchar) t[-1]]);
}
return (int) (s_len - t_len);
}
diff --git a/mysys/mf_soundex.c b/mysys/mf_soundex.c
index 8ecd95137b0..459e304dfd7 100644
--- a/mysys/mf_soundex.c
+++ b/mysys/mf_soundex.c
@@ -44,13 +44,14 @@ void soundex(CHARSET_INFO * cs,register my_string out_pntr, my_string in_pntr,
{
char ch,last_ch;
reg3 my_string end;
+ register uchar *map=cs->to_upper;
if (remove_garbage)
{
while (*in_pntr && my_isspace(cs,*in_pntr)) /* Skipp pre-space */
in_pntr++;
}
- *out_pntr++ = my_toupper(cs,*in_pntr);/* Copy first letter */
+ *out_pntr++ = map[(uchar)*in_pntr]; /* Copy first letter */
last_ch = get_scode(cs,&in_pntr,0); /* code of the first letter */
/* for the first 'double-letter */
/* check. */