Skip to content

Avoid allocations when escaping safe strings - #79

Open
quinnj wants to merge 1 commit into
masterfrom
perf/escape-unreserved
Open

quinnj wants to merge 1 commit into
masterfrom
perf/escape-unreserved

Conversation

@quinnj

@quinnj quinnj commented Sep 22, 2026

Copy link
Copy Markdown
Member

escapeuri and escapepath currently allocate even when a String needs no escaping. Return that immutable string directly for the built-in policies. If an escape occurs, reuse the checked prefix without repeating its predicate checks. Custom predicates keep their existing byte order and call count.

Warmed Julia 1.12.7 allocations: bucket 96→0 B; a 3,072-byte safe string 6,336→0 B; /bucket/key 112→0 B. Escaped-input allocations stayed unchanged across 432 cases on each tested version. Alternating local timing runs improved long escaped prefixes; short escaped/Unicode cases were roughly 2–3 ns slower. The host had concurrent work, so these are diagnostic timings.

Validation: full suites on Julia 1.6.7 and 1.12.7; 12,630 independent semantic comparisons per version; allocation guards; safe-trim compilation and 10 executable checks. Covers malformed UTF-8, substrings, and stateful custom predicates.

The candidate also passed 155 combined checks with HTTP #1374, CloudBase #48/#49 and CloudStore #71/#72, plus all eight HTTP buffered-transfer allocation guards. These used local mocks/storage emulators; no cloud-throughput claim.

Co-authored by Codex

@codecov

codecov Bot commented Sep 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.87%. Comparing base (a045d2d) to head (3686b7a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #79      +/-   ##
==========================================
+ Coverage   87.05%   87.87%   +0.81%     
==========================================
  Files           5        5              
  Lines         394      404      +10     
==========================================
+ Hits          343      355      +12     
+ Misses         51       49       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
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.

1 participant