Skip to content

Reduce URL percent-encoding allocations - #121

Merged
tanmaykm merged 1 commit into
JuliaComputing:mainfrom
quinnj:perf/reduce-path-escaping-allocations
Sep 21, 2026
Merged

tanmaykm merged 1 commit into
JuliaComputing:mainfrom
quinnj:perf/reduce-path-escaping-allocations

Conversation

@quinnj

@quinnj quinnj commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

The shared URL encoder formats and uppercases a temporary string for every escaped byte. Write each percent triplet directly from a hexadecimal digit table instead. This preserves the encoded bytes and existing unreserved-character rules while reducing allocations on every path/query parameter that requires escaping.

Warmed Julia 1.12.6 measurements on Apple Silicon (median of seven batches of 10,000 calls):

Input Before After Allocated bytes before → after
128 spaces 14.72 μs 2.55 μs 44,000 → 992
Unicode/path/query text 1.98 μs 0.54 μs 5,088 → 384
hello world! 352 ns 160 ns 864 → 192
Unescaped ASCII 193 ns 194 ns 192 → 192

Validation: full suites pass on Julia 1.10.11 and 1.12.6, including generated HTTP client/server tests, the JuliaC trimmed executable, and the pinned Petstore/Discord corpus. New checks cover all 256 byte values, Unicode, substring offsets, unreserved characters, and percent signs. git diff --check passes. No API or generated-runtime contract changes.

Co-authored by Codex

@tanmaykm
tanmaykm merged commit 9686862 into JuliaComputing:main Sep 21, 2026
4 checks passed
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