Repository navigation
perf: avoid copying already rooted request paths - #2794
Open
andreybolonin wants to merge 1 commit into
Open
andreybolonin wants to merge 1 commit into
andreybolonin wants to merge 1 commit into
Conversation
dunglas
approved these changes
Oct 31, 2026
This branch has not been deployed
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.
Preparing SCRIPT_FILENAME currently prepends
/even when the request path already starts with it. The resulting extra slash makespath.Cleanrebuild an otherwise clean path.Only prepend
/for unrooted paths. Keep path cleaning, the Windows locality check, and trailing-slash handling. Add cases for repeated leading slashes and traversal, plus a benchmark for rooted, relative, and traversal paths.Earlier standalone measurements of this helper (Go 1.27.3, darwin/arm64, median of five 200ms samples):
/index.php/products/catalog/index.phpThese are helper-level results, not whole-request or RSS measurements. Relative paths had a 2.4% time reduction with unchanged allocations; traversal paths had an 11.0% reduction with Go B/op dropping from 96 to 72. Benchmarks were not rerun for this PR.
Validation:
gofmtandgit diff --checkpassed.-racein an isolated harness without PHP linkage.