swiftlang / swiftlang/swift-experimental-string-processing
Log line matcher shows slow performance in failure
Open
Nobody has claimed this yet.
performance
- Dominant language
- Swift
- Stars
- 308
- Forks
- 52
- Avg merge
- 12h 45m
- Merged PRs (30d)
- 2
Description
As reported on the forums, a matcher a log line like this can have poor performance when failing to match:
[2025-09-01 12:34:56.789] [TRACE] [net.http] (1442) anna.smith+test@example.com | https://example.com | {"id": 42, "name": "Widget", "price": 12.50, "tags": ["swift","regex","benchmark"]} | let foo = 123; let bar = foo + 456 // sum | This is is a test with a repeated word word for backreference. | 0.0.0.0
The pattern in the post is written as RegexDSL, and translates to this pattern:
let logLine = #/
(?:
(?m:^)
\[
\d{4}-\d{2}-\d{2}
\s
\d{2}:\d{2}:\d{2}
\.
\d{3}
\] \[
(TRACE|DEBUG|INFO|WARN|ERROR)
\] \[
\w+
(?:\.\w+)*
\] \(
\d+
\)
\s+
[(?s:.)]*?
(?m:$)
){8}
/#
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the forum report and the inline Swift regex and log-line example, then reproduce the slow failure case with a benchmark. Trace the matcher behavior for this pattern and compare failing-match performance before and after the change. Done means the reported failure no longer exhibits poor performance, with regression coverage for the example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100