Repository navigation
ext/uri: Optimize GHSA-mg3p-mxj9-g2mm tests - #25818
Open
kocsismate wants to merge 3 commits into
Open
kocsismate wants to merge 3 commits into
kocsismate wants to merge 3 commits into
Conversation
kocsismate
force-pushed
the
uri-ghsa-test-optimization
branch
from
November 27, 2026 06:18
64767de to
ff38adc
Compare
TimWolla
reviewed
Nov 27, 2026
TimWolla
reviewed
Nov 27, 2026
Changing the input URI to a relative path reference makes the tests much faster, because uriparser only increases a pointer for each character while parsing the beginning of a URI while it's not yet known if the current component is a scheme or a path. On the other hand, uriparser calls a `URI_FUNC(ParsePchar)` function for each character while parsing the path after a "/" character (in case of absolute URIs, or absolute path references). Additionally, the strspn() call is replaced with strcmp() because strspn() was also slow. I tested the performance of my changes on Mac OS with ASAN, and the execution time of the first two tests decreased by ~40%, while GHSA-mg3p-mxj9-g2mm-3.phpt decreased by ~70%.
kocsismate
force-pushed
the
uri-ghsa-test-optimization
branch
from
November 27, 2026 12:23
ff38adc to
d32a3c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changing the input URI to a relative path reference makes the tests much faster, because uriparser only increases a pointer for each character while parsing the beginning of a URI while it's not yet known if the current component is a scheme or a path. On the other hand, uriparser calls a
URI_FUNC(ParsePchar)function for each character while parsing the path after a "/" character (in case of absolute URIs, or absolute path references).Additionally, the strspn() call is replaced with strcmp() because strspn() was also slow.
I tested the performance of my changes on Mac OS with ASAN, and the execution time of the first two tests decreased by ~40%, while GHSA-mg3p-mxj9-g2mm-3.phpt decreased by ~70%.