perf: don't bypass cache and use source instead of toString

This commit is contained in:
Viren070
2025-05-06 20:36:34 +01:00
parent 760fd27a15
commit b4e671d83f
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -135,7 +135,7 @@ export class AIOStreams {
Settings.DEFAULT_REGEX_EXCLUDE_PATTERN
: undefined;
const excludeRegex = excludeRegexPattern
? compileRegex(excludeRegexPattern, 'i', true)
? compileRegex(excludeRegexPattern, 'i')
: undefined;
const excludeKeywordsRegex = this.config.excludeFilters
@@ -147,7 +147,7 @@ export class AIOStreams {
Settings.DEFAULT_REGEX_INCLUDE_PATTERN
: undefined;
const requiredRegex = requiredRegexPattern
? compileRegex(requiredRegexPattern, 'i', true)
? compileRegex(requiredRegexPattern, 'i')
: undefined;
const requiredKeywordsRegex = this.config.strictIncludeFilters
@@ -162,7 +162,7 @@ export class AIOStreams {
? sortRegexPatterns
.split(/\s+/)
.filter(Boolean)
.map((pattern) => compileRegex(pattern, 'i', true))
.map((pattern) => compileRegex(pattern, 'i'))
: undefined;
excludeRegex ||
+1 -1
View File
@@ -30,7 +30,7 @@ export function safeRegexTest(
try {
return resultCache.wrap(
(p: RegExp, s: string) => isMatch(p, s, { timeout: timeoutMs }),
getTextHash(`${compiledPattern.toString()}|${str}`),
getTextHash(`${compiledPattern.source}|${str}`),
100,
compiledPattern,
str