Browse Source

Perf: speed up dedupe

SukkaW 2 years ago
parent
commit
70aebee857
1 changed files with 1 additions and 1 deletions
  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++) {
   for (let i = 0; i < chunkLength; i++) {
     const domainFromInputChunk = chunk[i];
     const domainFromInputChunk = chunk[i];
+    const domainFromInputLen = domainFromInputChunk.length;
 
 
     for (let j = 0; j < totalLen; j++) {
     for (let j = 0; j < totalLen; j++) {
       const domainStartsWithADotAndFromFullSet = fullsetDomainStartsWithADot[j];
       const domainStartsWithADotAndFromFullSet = fullsetDomainStartsWithADot[j];
       // domainFromFullSet is always startsWith "."
       // domainFromFullSet is always startsWith "."
       if (domainStartsWithADotAndFromFullSet === domainFromInputChunk) continue;
       if (domainStartsWithADotAndFromFullSet === domainFromInputChunk) continue;
 
 
-      const domainFromInputLen = domainFromInputChunk.length;
       const domainFromFullSetLen = domainStartsWithADotAndFromFullSet.length;
       const domainFromFullSetLen = domainStartsWithADotAndFromFullSet.length;
 
 
       if (domainFromInputLen < domainFromFullSetLen) {
       if (domainFromInputLen < domainFromFullSetLen) {