Perf: improve performance of reject suffix/keyword deduping

This commit is contained in:
SukkaW
2024-01-21 23:53:12 +08:00
parent 80deff88f9
commit 725f26b428
6 changed files with 39 additions and 55 deletions

View File

@@ -77,7 +77,7 @@ const createKeywordFilter = (keys: string[] | Set<string>) => {
build();
const search = (text: string) => {
return (text: string) => {
let node: Node | undefined = root;
for (let i = 0, textLen = text.length; i < textLen; i++) {
@@ -96,10 +96,6 @@ const createKeywordFilter = (keys: string[] | Set<string>) => {
return false;
};
return {
search
};
};
export default createKeywordFilter;