add orjson
State updates over the websocket and generated frontend files are serialized with orjson when the new reflex[orjson] extra is installed; without it Reflex falls back to the stdlib json module. Output is byte-compatible between the two backends, and inbound socket integers beyond 64 bits still reach event handlers exactly.
Benchmarks
Event wire path — decode 3 incoming events, process them, serialize 3 deltas — measured with each revision's own socket codec (_sio_dumps / _sio_loads). Python 3.14.7, 500 rounds, 3 interleaved repetitions; medians, ±1–2% run to run.
| small delta (~2 KB) | large delta (~200 KB) | |
|---|---|---|
| this branch + orjson | 217.0 µs (−5.0%) | 1234.3 µs (−28.0%, 1.39×) |
| this branch, no orjson | 234.8 µs (+2.8%) | 1811.5 µs (+5.7%) |
main | 228.4 µs | 1714.1 µs |
Outgoing encode in isolation (95.7 KB payload):
| encode | |
|---|---|
| this branch + orjson | 104.4 µs (2.44×) |
| this branch, no orjson | 284.0 µs (+11.3%) |
main | 255.2 µs |
Without the extra, the fallback adds two scans of the serialized string on top of the stdlib dump — the sentinel-collision check and the isascii() UTF-8 guard — about +29 µs on 95.7 KB.