Perf: reduce operations in normalizeDomain

This commit is contained in:
SukkaW
2025-01-17 21:28:28 +08:00
parent c07fe1dd56
commit c6bbbf9d4c
6 changed files with 29 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
import { processLine } from './lib/process-line';
import { normalizeDomain } from './lib/normalize-domain';
import { fastNormalizeDomain } from './lib/normalize-domain';
import { HostnameSmolTrie } from './lib/trie';
// import { Readable } from 'stream';
import { parse } from 'csv-parse/sync';
@@ -54,7 +54,7 @@ export async function parseGfwList() {
trie.add(line);
continue;
}
const d = normalizeDomain(line);
const d = fastNormalizeDomain(line);
if (d) {
trie.add(d);
continue;