瀏覽代碼

Perf: speed up dedupe

SukkaW 2 年之前
父節點
當前提交
70aebee857
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      Build/worker/build-reject-domainset-worker.js

+ 1 - 1
Build/worker/build-reject-domainset-worker.js

@@ -17,13 +17,13 @@ module.exports = ({ chunk }) => {
 
   for (let i = 0; i < chunkLength; i++) {
     const domainFromInputChunk = chunk[i];
+    const domainFromInputLen = domainFromInputChunk.length;
 
     for (let j = 0; j < totalLen; j++) {
       const domainStartsWithADotAndFromFullSet = fullsetDomainStartsWithADot[j];
       // domainFromFullSet is always startsWith "."
       if (domainStartsWithADotAndFromFullSet === domainFromInputChunk) continue;
 
-      const domainFromInputLen = domainFromInputChunk.length;
       const domainFromFullSetLen = domainStartsWithADotAndFromFullSet.length;
 
       if (domainFromInputLen < domainFromFullSetLen) {