Encode escapeuri byte by byte so it resolves under --trim - #77
Merged
Conversation
`join` over a generator routes through `Base.AnnotatedString`, which `juliac --trim=safe` cannot resolve: one `escapeuri(::String)` call costs 20 verifier errors. A byte loop over the same safe set produces identical output for every input, and is 3-6x faster.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #77 +/- ##
==========================================
+ Coverage 86.91% 87.02% +0.11%
==========================================
Files 5 5
Lines 382 393 +11
==========================================
+ Hits 332 342 +10
- Misses 50 51 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
quinnj
approved these changes
Sep 3, 2026
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.
escapeuri(::AbstractString, ::Function)builds its result withjoinover a generator, which routes throughBase.AnnotatedString— a path--trimcannot resolve. One call toescapeurion aStringfails ajuliac --experimental --trim=safebuild with 20 verifier errors.A byte loop appending to a
Vector{UInt8}does the same job and resolves.Measured on Julia 1.12.7:
Output is identical. 1,202,368 comparisons against the v1.7.0 implementation, zero mismatches.
Verifier errors 20 → 0. A
@maincallingescapeuri("hello world/foo?a=1&b=ü")now builds withjuliac --output-exe --experimental --trim=safeand prints the right answer; so do programs callingescapepathand a custom predicate.Tests pass, 304/304, including two new assertions for the
safeargument, which had none.Faster (
@btime):escapepath"hello world"Made by Claude