You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(v4): preserve JIT fastpass in parseMaybeAsync / safeParseMaybeAsync
The previous implementation forced ctx.async = true upfront, which
bypassed ZodObject's JIT fastpass (gated on ctx?.async === false strict)
and caused a ~5x slowdown on the sync hot path that 99% of consumers
take. This was the regression that closed#5924.
Run sync first (async: false) so the fastpass engages; only fall back to
the async path on $ZodAsyncError or a Promise return. Closures in the
hot path are flattened (the previous higher-order finalize factory
allocated per call).
Sync object schemas now match safeParse within benchmark noise; async
schemas pay one extra short-circuited sync pass that bails on the first
async check, which is the right tradeoff given async is the minority case.
Refs #5379, #5924.
0 commit comments