mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Perf: improve reject set dedupe performance
This commit is contained in:
@@ -43,39 +43,3 @@ exports.dedupe = ({ chunk }) => {
|
||||
|
||||
return outputToBeRemoved;
|
||||
};
|
||||
|
||||
exports.whitelisted = ({ whiteList }) => {
|
||||
const outputToBeRemoved = new Set();
|
||||
|
||||
for (const domain of workerData) {
|
||||
for (const white of whiteList) {
|
||||
if (domain.includes(white) || white.includes(domain)) {
|
||||
outputToBeRemoved.add(domain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return outputToBeRemoved;
|
||||
};
|
||||
|
||||
exports.dedupeKeywords = ({ keywords, suffixes }) => {
|
||||
const outputToBeRemoved = new Set();
|
||||
|
||||
for (const domain of workerData) {
|
||||
for (const keyword of keywords) {
|
||||
if (domain.includes(keyword) || keyword.includes(domain)) {
|
||||
outputToBeRemoved.add(domain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (const suffix of suffixes) {
|
||||
if (domain.endsWith(suffix)) {
|
||||
outputToBeRemoved.add(domain);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return outputToBeRemoved;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user