Repository navigation
Releases
Releases · mackoj/swift-curl
0.3.1
Performance release: same output, byte for byte, much faster on large values. No API change.
ShellEscaping.quotewas quadratic: it appended scalar by scalar throughunicodeScalars, copying the string each time. It now quotes UTF-8 bytes into one allocation. Rendering a 1 MB JSON body: 172 ms → 1.5 ms.- Substitutions match on UTF-8 bytes (equivalent to scalars) and are prepared once per
render; a piped binary body is only decoded when there are substitutions to look for. - Binary bodies are recognised from their control bytes before any decoding: converting a 1 MB binary body, 70 ms → 1.1 ms.
- Header names are lowercased once per header, and bridged header strings copied to native UTF-8 once: 50 headers, 192 µs → 114 µs per conversion.
| p50, release, Apple M5 Pro | 0.3.0 | 0.3.1 |
|---|---|---|
| Render, 1 MB JSON body | 172 ms | 1.5 ms |
| Convert and render, 1 MB binary body | 70 ms | 1.1 ms |
| Quote, 64 KB adversarial | 7.7 ms | 0.1 ms |
| Quote with substitutions, 128 KB | 18.7 ms | 0.37 ms |
| Convert and render, 50 headers (per conversion) | 192 µs | 114 µs |
| Convert and render, simple GET | 5.1 µs | 3.2 µs |
Also new in the repository: benchmarks (Benchmarks/, see docs/performance.md) and architecture rules that guard the quoting invariants (docs/architecture-rules.md).