Skip to content

[release/10.0] Improve PemEncoding.TryFind perf with degenerate inputs - #133250

Open
github-actions[bot] wants to merge 1 commit into
release/10.0from
backport/pr-133137-to-release/10.0
Open

[release/10.0] Improve PemEncoding.TryFind perf with degenerate inputs#133250
github-actions[bot] wants to merge 1 commit into
release/10.0from
backport/pr-133137-to-release/10.0

Conversation

@github-actions

@github-actionsgithub-actionsBot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Backport of #133137 to release/10.0

/cc @bartonjs

Customer Impact

  • Customer reported
  • Found internally

When TryFind is given degenerate input, it wastes a lot of CPU time realizing that "-----" is not valid Base64.

Regression

  • Yes
  • No

Testing

Existing tests say that the new algorithm does not regress functionality, and the new test shows that degenerate inputs are handled well over 10x faster.

Risk

Low, due to test coverage.

Rather than seeking for the correct PostEB, just ask if the next hyphen
is the PostEB. If not, we can bypass the IsValidBase64 checks.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@bartonjs

Copy link
Copy Markdown
Member

/ba-g all test errors are marked as known?

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.SecurityServicing-approvedApproved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@bartonjs