From 8c23e7919aec762a348a68191f0e6746e28e9270 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Sun, 9 Jun 2024 18:34:40 +0800 Subject: [PATCH] Perf: avoid extra `Map#get` in trie.add loop --- Build/lib/trie.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Build/lib/trie.ts b/Build/lib/trie.ts index de63affc..ebdd34d1 100644 --- a/Build/lib/trie.ts +++ b/Build/lib/trie.ts @@ -85,9 +85,9 @@ export const createTrie = (from?: string[] | Set | null, hostnameMode = if (node.has(token)) { node = node.get(token)!; - // During the adding of `[start]blog.skk.moe` and find out that there is a `[start].skk.moe` in the trie + // During the adding of `[start]blog|.skk.moe` and find out that there is a `[start].skk.moe` in the trie // Dedupe the covered subdomain by skipping - if (smolTree && hostnameMode && (node.get('.')?.[SENTINEL])) { + if (smolTree && token === '.' && node[SENTINEL]) { return; } } else {