diff options
author | Magne Mahre <magne.mahre@sun.com> | 2009-11-11 17:03:02 +0100 |
---|---|---|
committer | Magne Mahre <magne.mahre@sun.com> | 2009-11-11 17:03:02 +0100 |
commit | 3c3b11c3b876b36db7243d53390d02e9ffb3fad1 (patch) | |
tree | bd6c6b3dc2db4640166de7823092fdb3a6934955 /strings/ctype-mb.c | |
parent | 1c3c72ce178f8a0139066d90836e2b9e11324723 (diff) | |
download | mariadb-git-3c3b11c3b876b36db7243d53390d02e9ffb3fad1.tar.gz |
Bug #14637: trim trailing spaces processes data only byte wise
(From: gkodinov)
Use and int * where possible to scan for trailing space in a
string instead of always iterating char-by-char.
Using the attached benchmark file on a 32 bit Intel Core 2
Duo CPU I've got 43485 ms run with the fix compared to 44373
without it.
Backported to 5.6.0 (next-mr-runtime)
6.0-codebase revid: 2476.1362.1
include/m_string.h:
scan for space through ints
strings/ctype-bin.c:
scan for space through ints
strings/ctype-latin1.c:
scan for space through ints
strings/ctype-mb.c:
scan for space through ints
strings/ctype-simple.c:
scan for space through ints
Diffstat (limited to 'strings/ctype-mb.c')
-rw-r--r-- | strings/ctype-mb.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index 903811e2ab9..b0f7c297260 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -469,14 +469,11 @@ static void my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), { const uchar *pos = key; - key+= len; - /* Remove trailing spaces. We have to do this to be able to compare 'A ' and 'A' as identical */ - while (key > pos && key[-1] == ' ') - key--; + key= skip_trailing_space(key, len); for (; pos < (uchar*) key ; pos++) { |