Commit 53280cf
authored
perf(rpc,openapi): speed up RPC and OpenAPI serializers (#1731)
## Summary
Speeds up `RPCSerializer` and `OpenAPISerializer` round trips, mainly by
skipping per-value handler condition checks for primitives and avoiding
per-node path allocations while walking payloads.
In same-process A/B benches against the previous implementation:
- RPC round trips are roughly 1.5x to 2x faster
- OpenAPI round trips are roughly 1.3x to 3x faster
- Default construction (no custom handlers) allocates nothing
## Other changes
- Blobs returned by terminal custom handlers are now collected into
`maps`/`blobs`, so they survive FormData transport
- Serializer and bracket-notation tests are rewritten around real-world
round trips, edge cases, malicious payloads, and prototype pollution
attacks, with 100% coverage of the touched files
- Docs: bracket notation now lists keys containing `[` or `]` as a
limitation
## Notes for reviewers
- Custom handlers keep working unchanged. When a custom handler
overrides or disables a built-in key, the serializer falls back to the
previous scan behavior
- On the fast path, custom handlers are not called for values built-ins
already claim (primitives, null, and built-in object types); this is
documented in code1 parent 9a732a1 commit 53280cf
11 files changed
Lines changed: 972 additions & 217 deletions
File tree
- apps/content/docs/openapi
- packages
- client/src
- openapi/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
0 commit comments