Perf: repalce aho-corasick w/ regexp

This commit is contained in:
SukkaW
2025-01-03 22:30:39 +08:00
parent 090f055677
commit ef1b80fb90
7 changed files with 14 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
import { merge } from 'fast-cidr-tools';
import type { Span } from '../../trace';
import { createAhoCorasick as createKeywordFilter } from 'foxts/ahocorasick';
import { createRetrieKeywordFilter as createKeywordFilter } from 'foxts/retrie';
import { appendArrayInPlace } from '../append-array-in-place';
import { appendSetElementsToArray } from 'foxts/append-set-elements-to-array';
import type { SingboxSourceFormat } from '../singbox';
@@ -17,7 +17,7 @@ export class RulesetOutput extends RuleOutput<Preprocessed> {
}
protected preprocess() {
const kwfilter = createKeywordFilter(this.domainKeywords);
const kwfilter = createKeywordFilter(Array.from(this.domainKeywords));
const domains: string[] = [];
const domainSuffixes: string[] = [];