mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Perf: many changes
- Hoist process hosts line callback - Reduce dp hosts file size - Reduce domain sort
This commit is contained in:
@@ -18,14 +18,9 @@ import { getPhishingDomains } from './lib/get-phishing-domains';
|
||||
|
||||
import * as SetHelpers from 'mnemonist/set';
|
||||
import { setAddFromArray } from './lib/set-add-from-array';
|
||||
import type { PublicSuffixList } from '@gorhill/publicsuffixlist';
|
||||
|
||||
export const buildRejectDomainSet = task(import.meta.path, async (span) => {
|
||||
const gorhillPromise = getGorhillPublicSuffixPromise();
|
||||
const gorhillPeeked = Bun.peek(gorhillPromise);
|
||||
const gorhill: PublicSuffixList = gorhillPeeked === gorhillPromise
|
||||
? await gorhillPromise
|
||||
: (gorhillPeeked as PublicSuffixList);
|
||||
const gorhill = await getGorhillPublicSuffixPromise();
|
||||
|
||||
/** Whitelists */
|
||||
const filterRuleWhitelistDomainSets = new Set(PREDEFINED_WHITELIST);
|
||||
@@ -126,7 +121,7 @@ export const buildRejectDomainSet = task(import.meta.path, async (span) => {
|
||||
const kwfilter = createKeywordFilter(domainKeywordsSet);
|
||||
|
||||
for (const domain of domainSets) {
|
||||
// Remove keyword
|
||||
// Remove keyword
|
||||
if (kwfilter(domain)) {
|
||||
domainSets.delete(domain);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user