Perf: minor optimization here and there

This commit is contained in:
SukkaW
2024-01-11 11:56:15 +08:00
parent d06fa6975d
commit e8f3519479
11 changed files with 80 additions and 60 deletions

View File

@@ -32,7 +32,10 @@ export const getMicrosoftCdnRulesetPromise = createMemoizedPromise(async () => {
});
const trie2 = createTrie(set);
BLACKLIST.flatMap(domain => trie2.find(domain, true)).forEach(d => set.delete(d));
const black = BLACKLIST.flatMap(domain => trie2.find(domain, true));
for (let i = 0, len = black.length; i < len; i++) {
set.delete(black[i]);
}
return Array.from(set).map(d => `DOMAIN-SUFFIX,${d}`).concat(WHITELIST);
});