mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Perf: avoid mutate string in ruleset base
This commit is contained in:
@@ -23,13 +23,13 @@ export class RulesetOutput extends RuleOutput<Preprocessed> {
|
||||
const domainSuffixes: string[] = [];
|
||||
const sortedDomainRules: string[] = [];
|
||||
|
||||
this.domainTrie.dump((domain) => {
|
||||
this.domainTrie.dumpWithoutDot((domain, includeAllSubdomain) => {
|
||||
if (kwfilter(domain)) {
|
||||
return;
|
||||
}
|
||||
if (domain[0] === '.') {
|
||||
domainSuffixes.push(domain.slice(1));
|
||||
sortedDomainRules.push(`DOMAIN-SUFFIX,${domain.slice(1)}`);
|
||||
if (includeAllSubdomain) {
|
||||
domainSuffixes.push(domain);
|
||||
sortedDomainRules.push(`DOMAIN-SUFFIX,${domain}`);
|
||||
} else {
|
||||
domains.push(domain);
|
||||
sortedDomainRules.push(`DOMAIN,${domain}`);
|
||||
|
||||
Reference in New Issue
Block a user