Perf: faster reject domainset build

This commit is contained in:
SukkaW
2022-11-05 17:16:10 +08:00
parent 94db04effc
commit e1b57dd48e
3 changed files with 5 additions and 24 deletions

View File

@@ -227,25 +227,11 @@ async function processFilterRules (filterRulesUrl, fallbackUrls) {
function preprocessFullDomainSetBeforeUsedAsWorkerData (data) {
return data.filter(domain => (
domain.charCodeAt(0) === 46
&& !canExcludeFromDedupe(domain)
));
}
// duckdns.org domain will not overlap and doesn't need dedupe
function canExcludeFromDedupe (domain) {
if (
// starts with a dot
domain.charCodeAt(0) === 46
&& domain.length === 23
&& domain.endsWith('.duckdns.org')
) {
return true;
}
return false;
}
module.exports.processDomainLists = processDomainLists;
module.exports.processHosts = processHosts;
module.exports.processFilterRules = processFilterRules;
module.exports.preprocessFullDomainSetBeforeUsedAsWorkerData = preprocessFullDomainSetBeforeUsedAsWorkerData;
module.exports.canExcludeFromDedupe = canExcludeFromDedupe;