r/programming • u/gajus0 • Aug 29 '26
Zod v4.5 adds schema compilation (3-9x faster validation)
https://x.com/colinhacks/status/2093725420462182512
173
Upvotes
r/programming • u/gajus0 • Aug 29 '26
39
u/gajus0 Aug 29 '26
I've not been given any heads up that this is being released, so unfortunately playing a catch up. But if you are wondering how does this compare to
zod-compiler, here is their internal benchmarkI will update zod-compiler benchmark to include a comparison against Zod's native implementation.
I expect the two to eventually converge.
37
u/repeating_bears Aug 29 '26
Cool but implemented wrong.
This should be a build plugin (vite and whatever else). Shipping a 7k compiler to the client just for the philosophical purity of "doesn't require a build step" isn't a good tradeoff
How many serious projects don't have a build step already?
68
u/segv Aug 29 '26
Is there any particular reason why this compilation is not turned on by default? Needing a "magic" second import in every file with a schema is rather.. inconvenient.
41
u/BadlyCamouflagedKiwi Aug 29 '26
Statically typed languages: Look what they have to do to mimic a fraction of our power...
1
u/case-o-nuts Aug 30 '26
Why would anyone still be on Twitter?
-5
u/kiljacken Aug 29 '26
What the heck is a zod?
-10
u/Fair-Presentation322 Aug 30 '26
The fact that Zod exists shows that we failed as an industry.
2
u/[deleted] Aug 30 '26
[removed] — view removed comment