News for hackers. Stuff that matters.
Re:Zod 4 by satvikpendem on Monday May 19, 2025 @11:52AM (#44031120)
Zod 4 looks good but even with their latest improvements, ArkType is still an order of magnitude faster. Sometimes for the sake of backward and syntax compatibility, it is difficult to make something much faster than a fully greenfield newer library. We recently did an analysis of all these types of tools for our project and decided to go with ArkType for partially this reason, the other was TypeScript ergonomics felt nicer.
Re:Zod 4 by atonse on Monday May 19, 2025 @12:20PM (#44031449)
I was looking at all their speed metrics, and can you explain to me where the speed makes a difference?

We only use zod to validate forms, so I keep thinking "how does this matter?" Are people maybe using it to validate high throughput API input messages or something like that, where performance may matter more?

Re:Zod 4 by satvikpendem on Monday May 19, 2025 @12:22PM (#44031475)
Yes, we use it to validate the API responses from the backend (as well as type validation on the backend itself from any frontend POST requests), and especially on the client side, speed and bundle size is very important.
Re:Zod 4 by yhprum on Monday May 19, 2025 @01:26PM (#44032275)
Does arktype not come with a larger bundle size than zod? That was the reason I was shying away from it at the moment, especially with the bundle size reductions with zod 4 as well

[1] https://www.reddit.com/r/typescript/comments/1i3ogwi/announc...

Re:Zod 4 by vlovich123 on Monday May 19, 2025 @03:26PM (#44033788)
Yeah, I can't see zod really adding that much overhead in the critical latency path for all but extremely large responses. Sometimes people pick "the fastest" library without considering whether the performance is relevant for a given code path.
Re:Zod 4 by andrewflnr on Monday May 19, 2025 @12:27PM (#44031526)
Interesting, that one didn't even appear in my research. I was specifically looking for typescript ergonomics too. Probably still not going to switch away from Zod, though.
Re:Zod 4 by sroussey on Monday May 19, 2025 @01:16PM (#44032135)
Why ArkType over TypeBox?
Re:Zod 4 by dangoodmanUT on Monday May 19, 2025 @03:25PM (#44033777)
ArkType is a nightmare to use, zod is nice to use
Re:Zod 4 by lhnz on Monday May 19, 2025 @03:47PM (#44034038)
Out of interest, why is it a nightmare to use?

I've always been worried about how overly clever the approach is, does it have problems?