mirror of
https://github.com/Viren070/AIOStreams.git
synced 2025-12-01 23:14:04 +01:00
perf: don't bypass cache and use source instead of toString
This commit is contained in:
@@ -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 ||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user