Skip to content

Optimize regex usage + improve parsing performance - #5

Merged
HaGGi13 merged 2 commits into
developfrom
feature/optimize-performance-and-allocation
Feb 22, 2026
Merged

Optimize regex usage + improve parsing performance#5
HaGGi13 merged 2 commits into
developfrom
feature/optimize-performance-and-allocation

Conversation

@HaGGi13

@HaGGi13 HaGGi13 commented Feb 22, 2026

Copy link
Copy Markdown
Owner

Optimize regex usage + improve parsing performance

Removed redundant RegexOptions.Compiled flag from the GeneratedRegex
attribute because the source generator produces by default an already
optimized RegEx at compile time.
Replaced .Value with .ValueSpan to minimize string allocation and
enhance performance during parsing.
Cached frequently accessed Group instances to avoid redundant lookups.
Updated exception handling in parsing methods to specify relevant
exceptions (FormatException and OverflowException).

Improved README formatting and grammar.
Added usage examples for both human-readable and standard duration
formats.
Updated benchmark results to reflect changes in performance.

Removed redundant `RegexOptions.Compiled` flag from the `GeneratedRegex`
attribute because the source generator produces by default an already
optimized RegEx at compile time.
Replaced `.Value` with `.ValueSpan` to minimize string allocation and
enhance performance during parsing.
Cached frequently accessed `Group` instances to avoid redundant lookups.
Updated exception handling in parsing methods to specify relevant
exceptions (`FormatException` and `OverflowException`).
Improved README formatting and grammar.
Added usage examples for both human-readable and standard duration
formats.
Updated benchmark results to reflect changes in performance.
@HaGGi13 HaGGi13 self-assigned this Feb 22, 2026
@HaGGi13
HaGGi13 merged commit fc117c4 into develop Feb 22, 2026
4 checks passed
@HaGGi13
HaGGi13 deleted the feature/optimize-performance-and-allocation branch February 22, 2026 13:36
HaGGi13 added a commit that referenced this pull request Feb 22, 2026
Optimize regex usage + improve parsing performance

Removed redundant `RegexOptions.Compiled` flag from the `GeneratedRegex`
attribute because the source generator produces by default an already
optimized RegEx at compile time.
Replaced `.Value` with `.ValueSpan` to minimize string allocation and
enhance performance during parsing.
Cached frequently accessed `Group` instances to avoid redundant lookups.
Updated exception handling in parsing methods to specify relevant
exceptions (`FormatException` and `OverflowException`).

Improved README formatting and grammar.
Added usage examples for both human-readable and standard duration
formats.
Updated benchmark results to reflect changes in performance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant