Perf: make dedupe faster

This commit is contained in:
SukkaW 2023-06-14 23:22:17 +08:00
parent bf4c92cc5d
commit 6aeb5def04

View File

@ -1,7 +1,7 @@
// @ts-check // @ts-check
const Piscina = require('piscina'); const Piscina = require('piscina');
// const { isCI } = require('ci-info'); // const { isCI } = require('ci-info');
/** @type {string[]} */
const fullsetDomainStartsWithADot = Piscina.workerData const fullsetDomainStartsWithADot = Piscina.workerData
const totalLen = fullsetDomainStartsWithADot.length; const totalLen = fullsetDomainStartsWithADot.length;
@ -35,7 +35,7 @@ module.exports = ({ chunk }) => {
} else { } else {
break; break;
} }
} else if (domainFromInputChunk.endsWith(domainStartsWithADotAndFromFullSet)) { } else if (domainFromInputLen > domainFromFullSetLen && domainFromInputChunk.endsWith(domainStartsWithADotAndFromFullSet)) {
outputToBeRemoved[i] = 1; outputToBeRemoved[i] = 1;
// log(domainFromInputChunk, domainStartsWithADotAndFromFullSet) // log(domainFromInputChunk, domainStartsWithADotAndFromFullSet)
break; break;