mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 23:24:39 +00:00
wcsfilecmp: Don't use iswdigit
For some godforsaken reason it's slow on glibc Like, actually, this manages to somehow make "echo **" 10% faster now? The spec says this matches 0 through 9 always, so this is safe. We also use this logic in a variety of other places already.
This commit is contained in:
parent
71a0d839a7
commit
1ab81ab90d
1 changed files with 2 additions and 2 deletions
|
@ -55,7 +55,7 @@ int wcsfilecmp(const wchar_t *a, const wchar_t *b) {
|
|||
int retval = 0; // assume the strings will be equal
|
||||
|
||||
while (*a && *b) {
|
||||
if (iswdigit(*a) && iswdigit(*b)) {
|
||||
if (*a >= L'0' && *a <= L'9' && *b >= L'0' && *b <= L'9') {
|
||||
retval = wcsfilecmp_leading_digits(&a, &b);
|
||||
// If we know the strings aren't logically equal or we've reached the end of one or both
|
||||
// strings we can stop iterating over the chars in each string.
|
||||
|
@ -115,7 +115,7 @@ int wcsfilecmp_glob(const wchar_t *a, const wchar_t *b) {
|
|||
int retval = 0; // assume the strings will be equal
|
||||
|
||||
while (*a && *b) {
|
||||
if (iswdigit(*a) && iswdigit(*b)) {
|
||||
if (*a >= L'0' && *a <= L'9' && *b >= L'0' && *b <= L'9') {
|
||||
retval = wcsfilecmp_leading_digits(&a, &b);
|
||||
// If we know the strings aren't logically equal or we've reached the end of one or both
|
||||
// strings we can stop iterating over the chars in each string.
|
||||
|
|
Loading…
Reference in a new issue