TLDR Dev · ARTICLES & TUTORIALS

REDUCING ZOD'S MEMORY FOOTPRINT BY AN ORDER OF MAGNITUDE WITH METHOD MEMOIZATION

zod.dev4 min read

Summary from the TLDR Dev newsletter

Zod 4.5 cuts schema memory use by creating bound methods only when they are first accessed instead of attaching dozens of closures to every instance. A bare z.string() now retains 784 bytes instead of 7.5 KB, with 2× to nearly 10× reductions across the benchmarked schema types.