Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4272eec0
Commit
4272eec0
authored
Oct 24, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17534 Implement fast path for ASCII range in strnxfrm_onelevel_internal()
parent
88cfde26
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
strings/ctype-uca.ic
strings/ctype-uca.ic
+39
-0
No files found.
strings/ctype-uca.ic
View file @
4272eec0
...
@@ -559,6 +559,45 @@ MY_FUNCTION_NAME(strnxfrm_onelevel_internal)(CHARSET_INFO *cs,
...
@@ -559,6 +559,45 @@ MY_FUNCTION_NAME(strnxfrm_onelevel_internal)(CHARSET_INFO *cs,
DBUG_ASSERT(src || !srclen);
DBUG_ASSERT(src || !srclen);
#if MY_UCA_ASCII_OPTIMIZE && !MY_UCA_COMPILE_CONTRACTIONS
/*
Fast path for the ASCII range with no contractions.
*/
{
const uchar *de2= de - 1; /* Last position where 2 bytes fit */
const uint16 *weights0= level->weights[0];
uint lengths0= level->lengths[0];
for ( ; ; src++, srclen--)
{
const uint16 *weight;
if (!srclen || !*nweights)
return dst; /* Done */
if (*src > 0x7F)
break; /* Non-ASCII */
weight= weights0 + (((uint) *src) * lengths0);
if (!(s_res= *weight))
continue; /* Ignorable */
if (weight[1]) /* Expansion (e.g. in a user defined collation */
break;
/* Here we have a character with extactly one 2-byte UCA weight */
if (dst < de2) /* Most typical case is when both bytes fit */
{
*dst++= s_res >> 8;
*dst++= s_res & 0xFF;
(*nweights)--;
continue;
}
if (dst >= de) /* No space left in "dst" */
return dst;
*dst++= s_res >> 8; /* There is space only for one byte */
(*nweights)--;
return dst;
}
}
#endif
my_uca_scanner_init_any(&scanner, cs, level, src, srclen);
my_uca_scanner_init_any(&scanner, cs, level, src, srclen);
for (; dst < de && *nweights &&
for (; dst < de && *nweights &&
(s_res= MY_FUNCTION_NAME(scanner_next)(&scanner)) > 0 ; (*nweights)--)
(s_res= MY_FUNCTION_NAME(scanner_next)(&scanner)) > 0 ; (*nweights)--)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment