mirror of
https://github.com/SukkaW/Surge.git
synced 2026-09-12 10:34:35 +08:00
Perf: even faster reject building flow
This commit is contained in:
@@ -15,7 +15,6 @@ import { SHARED_DESCRIPTION } from './constants/description';
|
|||||||
import { addArrayElementsToSet } from 'foxts/add-array-elements-to-set';
|
import { addArrayElementsToSet } from 'foxts/add-array-elements-to-set';
|
||||||
import { OUTPUT_INTERNAL_DIR, SOURCE_DIR } from './constants/dir';
|
import { OUTPUT_INTERNAL_DIR, SOURCE_DIR } from './constants/dir';
|
||||||
import { DomainsetOutput, AdGuardHomeOutput } from './lib/rules/domainset';
|
import { DomainsetOutput, AdGuardHomeOutput } from './lib/rules/domainset';
|
||||||
import { HostnameSmolTrie } from 'hntrie/smol';
|
|
||||||
import { getBuildWorkerFarm } from './lib/build-worker-farm';
|
import { getBuildWorkerFarm } from './lib/build-worker-farm';
|
||||||
import { RulesetOutput } from './lib/rules/ruleset';
|
import { RulesetOutput } from './lib/rules/ruleset';
|
||||||
import { fetchAssets } from './lib/fetch-assets';
|
import { fetchAssets } from './lib/fetch-assets';
|
||||||
@@ -249,9 +248,9 @@ export const buildRejectDomainSet = task(require.main === module, __filename)(as
|
|||||||
});
|
});
|
||||||
|
|
||||||
// reject-adguardhome starts from the (whitelisted) reject trie and adds to it.
|
// reject-adguardhome starts from the (whitelisted) reject trie and adds to it.
|
||||||
// Cloning (~70ms, ~25ms once hntrie ships a native clone()) instead of sharing
|
// Cloning (~25ms for ~135k entries) instead of sharing the trie lets its write
|
||||||
// the trie lets its write run alongside the others instead of waiting for the
|
// run alongside the others instead of waiting for the reject write to finish
|
||||||
// reject write to finish first (~0.4s serial on CI). See lib/trie-clone.bench.ts.
|
// first (~0.4s serial on CI).
|
||||||
const rejectOutputAdGuardHome = new AdGuardHomeOutput(span, 'reject-adguardhome', OUTPUT_INTERNAL_DIR)
|
const rejectOutputAdGuardHome = new AdGuardHomeOutput(span, 'reject-adguardhome', OUTPUT_INTERNAL_DIR)
|
||||||
.withTitle('Sukka\'s Ruleset - AdGuardHome Blocklist')
|
.withTitle('Sukka\'s Ruleset - AdGuardHome Blocklist')
|
||||||
.withDescription([
|
.withDescription([
|
||||||
@@ -260,8 +259,7 @@ export const buildRejectDomainSet = task(require.main === module, __filename)(as
|
|||||||
|
|
||||||
rejectOutputAdGuardHome.domainTrie = span.traceChildSync(
|
rejectOutputAdGuardHome.domainTrie = span.traceChildSync(
|
||||||
'clone reject trie for adguardhome',
|
'clone reject trie for adguardhome',
|
||||||
// TODO: HostnameSmolTrie#clone() once available, the binary round trip is the public-API stand-in
|
() => rejectDomainsetOutput.domainTrie.clone(),
|
||||||
() => HostnameSmolTrie.deserializeTransferable(rejectDomainsetOutput.domainTrie.serializeTransferable()),
|
|
||||||
SpanCategory.Compute
|
SpanCategory.Compute
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"fdir": "^6.5.0",
|
"fdir": "^6.5.0",
|
||||||
"fnv1a52": "^1.0.0",
|
"fnv1a52": "^1.0.0",
|
||||||
"hash-wasm": "^4.12.0",
|
"hash-wasm": "^4.12.0",
|
||||||
"hntrie": "^1.1.0",
|
"hntrie": "^1.2.0",
|
||||||
"null-prototype-object": "^1.2.7",
|
"null-prototype-object": "^1.2.7",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
"stable-hash": "^0.0.6",
|
"stable-hash": "^0.0.6",
|
||||||
|
|||||||
10
pnpm-lock.yaml
generated
10
pnpm-lock.yaml
generated
@@ -155,8 +155,8 @@ importers:
|
|||||||
specifier: ^4.12.0
|
specifier: ^4.12.0
|
||||||
version: 4.12.0
|
version: 4.12.0
|
||||||
hntrie:
|
hntrie:
|
||||||
specifier: ^1.1.0
|
specifier: ^1.2.0
|
||||||
version: 1.1.0
|
version: 1.2.0
|
||||||
null-prototype-object:
|
null-prototype-object:
|
||||||
specifier: ^1.2.7
|
specifier: ^1.2.7
|
||||||
version: 1.2.7
|
version: 1.2.7
|
||||||
@@ -1506,8 +1506,8 @@ packages:
|
|||||||
hash-wasm@4.12.0:
|
hash-wasm@4.12.0:
|
||||||
resolution: {integrity: sha512-+/2B2rYLb48I/evdOIhP+K/DD2ca2fgBjp6O+GBEnCDk2e4rpeXIK8GvIyRPjTezgmWn9gmKwkQjjx6BtqDHVQ==}
|
resolution: {integrity: sha512-+/2B2rYLb48I/evdOIhP+K/DD2ca2fgBjp6O+GBEnCDk2e4rpeXIK8GvIyRPjTezgmWn9gmKwkQjjx6BtqDHVQ==}
|
||||||
|
|
||||||
hntrie@1.1.0:
|
hntrie@1.2.0:
|
||||||
resolution: {integrity: sha512-OQcAZvpOKpwFOq30q93YgpaE3EEcTMnU2+QMuLuwat1RXasAfPV7F/SUQI8z1vJLVxIJshLphRlXMnF+tvRpDQ==}
|
resolution: {integrity: sha512-p/I3J3JWdPcvVASK0SEEHNut9WaeGzAjyw90agTqBUUU/GZZeZoEnPKbHsid1UvtlBSOZn9yXFCEwXo0pEKOmw==}
|
||||||
|
|
||||||
htmlparser2@6.1.0:
|
htmlparser2@6.1.0:
|
||||||
resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==}
|
resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==}
|
||||||
@@ -3169,7 +3169,7 @@ snapshots:
|
|||||||
|
|
||||||
hash-wasm@4.12.0: {}
|
hash-wasm@4.12.0: {}
|
||||||
|
|
||||||
hntrie@1.1.0:
|
hntrie@1.2.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
foxts: 5.9.1
|
foxts: 5.9.1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user