Range

Strings Go Fast

July 18, 2026

Sequence

7:29 PM

User message about processing strings together followed by the complete Codex response behind the Strings Go Fast optimization
Owned String storage carries length, capacity, and data forward so unique growth can extend the same allocation.

Improvement

July 18, 2026

100k appends · Range

~120× faster~2,800× less peak memory
Range String performance before and after loweringMedian wall time falls from 491.2 milliseconds to 4.1 milliseconds, while peak memory falls from 5.3 gigabytes to 1.9 megabytes.491.2 ms5.3 GB4.1 ms1.9 MBBeforeAfter

Strings

100k appends
C 3.9 msabsolute best
C++ 3.9 msabsolute best
Range 4.1 ms
Rust 4.2 ms
Go 4.8 ms
Swift 5.6 ms

Range peak memory: 1.9 MB

Scaling

July 18, 2026

100k appends

30 runs
C 4.2 msabsolute best
C++ 4.3 ms
Range 4.3 ms
Rust 4.4 ms
Go 5.3 ms
Swift 6.2 ms

1m appends

30 runs
C++ 8.2 msabsolute best
C 8.7 ms
Rust 8.9 ms
Go 9.5 ms
Range 10.1 ms
Swift 20.7 ms

5m appends

30 runs
C 20.0 msabsolute best
C++ 20.2 ms
Rust 20.3 ms
Go 21.3 ms
Range 27.2 ms
Swift 62.1 ms

10m appends

30 runs
C 36.1 msabsolute best
Rust 36.2 ms
C++ 36.3 ms
Go 37.0 ms
Range 50.1 ms
Swift 118.4 ms