Perf: speed up dedupe

This commit is contained in:
SukkaW
2023-07-05 21:35:47 +08:00
parent 21522645ae
commit 70aebee857

View File

@@ -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) {