mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Perf: repalce String#localeCompare w/ simple ASCII-only compare
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* Hostbane-Optimized Trie based on Mnemonist Trie
|
||||
*/
|
||||
|
||||
import { fastStringArrayJoin } from './misc';
|
||||
import { fastStringArrayJoin, fastStringCompare } from './misc';
|
||||
import util from 'node:util';
|
||||
import { noop } from 'foxact/noop';
|
||||
import FIFO from './fifo';
|
||||
@@ -251,7 +251,7 @@ abstract class Triebase<Meta = any> {
|
||||
|
||||
static compare(this: void, a: string, b: string) {
|
||||
if (a === b) return 0;
|
||||
return (a.length - b.length) || a.localeCompare(b);
|
||||
return (a.length - b.length) || fastStringCompare(a, b);
|
||||
}
|
||||
|
||||
private walkWithSort(
|
||||
|
||||
Reference in New Issue
Block a user