Skip to content

Optimize string validation#1093

Merged
mtdowling merged 1 commit intomainfrom
optimize-string-validation
Mar 20, 2026
Merged

Optimize string validation#1093
mtdowling merged 1 commit intomainfrom
optimize-string-validation

Conversation

@mtdowling
Copy link
Member

Removes some polymorphic call sites to improve string validation.

Benchmark Before After Delta
stringNoValidation 12.510 ns 12.333 ns -1.4%
stringLengthOnly 11.719 ns 11.790 ns ~same
stringEnumOnly 13.095 ns 13.026 ns ~same
stringPatternOnly 130.240 ns 90.003 ns -30.9%
stringComposite 166.059 ns 142.517 ns -14.2%

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Removes some polymorphic call sites to improve string validation.

| Benchmark          | Before     | After      | Delta  |
|--------------------|------------|------------|--------|
| stringNoValidation | 12.510 ns  | 12.333 ns  | -1.4%  |
| stringLengthOnly   | 11.719 ns  | 11.790 ns  | ~same  |
| stringEnumOnly     | 13.095 ns  | 13.026 ns  | ~same  |
| stringPatternOnly  | 130.240 ns | 90.003 ns  | -30.9% |
| stringComposite    | 166.059 ns | 142.517 ns | -14.2% |
@mtdowling mtdowling merged commit ffa5944 into main Mar 20, 2026
4 checks passed
@mtdowling mtdowling deleted the optimize-string-validation branch March 20, 2026 23:30
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.

2 participants