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-latin1.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-latin1.c')
-rw-r--r-- | strings/ctype-latin1.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index e5333c4101b..dbd91c09637 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -678,13 +678,12 @@ void my_hash_sort_latin1_de(CHARSET_INFO *cs __attribute__((unused)), const uchar *key, size_t len, ulong *nr1, ulong *nr2) { - const uchar *end= key+len; + const uchar *end; /* Remove end space. We have to do this to be able to compare 'AE' and 'Ä' as identical */ - while (end > key && end[-1] == ' ') - end--; + end= skip_trailing_space(key, len); for (; key < end ; key++) { |