瀏覽代碼

Perf: avoid extra `Map#get` in trie.add loop

SukkaW 1 年之前
父節點
當前提交
8c23e7919a
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Build/lib/trie.ts

+ 2 - 2
Build/lib/trie.ts

@@ -85,9 +85,9 @@ export const createTrie = (from?: string[] | Set<string> | 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 {