Repository navigation
Commit dc3b0cf
perf: walk tx.run results for unsafe integers only when one was parsed
extract_zql_result walked every decoded result looking for an integer
outside JavaScript's safe range, calling js_keys on each object. On a
10k-row result the walk cost more than json.loads itself. parse_int now
sets a flag when it builds an _Unsafe, and the walk runs only when the
flag is set. The error path and message are unchanged.
On the 10k-row bench against @rocicorp/zero 1.10.0 (asyncpg), flat went
from 2.17x TS to 0.90x and related from 1.51x to 0.95x.
The SQL tier now reaches the walk only through the pinned counter query,
so two unit tests cover the rest of it: one checks the path in the
message, and one checks that an unsafe integer replaced by a duplicate
key is still ignored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent fecb718 commit dc3b0cf
2 files changed
Lines changed: 28 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | 26 | | |
32 | 27 | | |
33 | 28 | | |
| |||
53 | 48 | | |
54 | 49 | | |
55 | 50 | | |
56 | | - | |
57 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
0 commit comments