@arktypeio @itsithu Is there a benchmark for validator instantiation (the new Function())? I know TypeBox does it through generators. How does ArkType do it?
@jherr API is a matter of preference but the bundle is still smaller than zod mini, slight faster at validation and much faster at instantiation (great for serverless environments where there might be many schemas created, increasing cold start)
@RyanCarniato@solid_js Client changes first please. It's also easier to migrate piece-wise, rather than try to migrate the client and server at the same time
@FabianHiller @quronekox the apis between zod/mini and valibot are very similar. would be a better to sell if performance (runtime and types) was demonstrably better. for runtime, the faster validator instantiation is often overlooked for the slower start-up JIT validators
@mikethough@letstri@arktypeio In serverless contexts, this is likely not gonna be faster since initializing a performant version of the validator takes longer. It could be faster if you have hundreds of variables but that's just a guess. @valibot would be better here but use whichever you like
@jachands@arktypeio this is likely due to "new Function" which arktype, along with typebox, uses under the hood to generate JIT-optimised validators. makes validation very fast but startup lil slow. In practice, time saved validating a few schemas would compensate for the startup time.
@matteocollina@RyanCarniato 5 hour Ryan stream explaining it: https://t.co/Jm3IhsHGbp
It's basically compiling the jsx into string templates, makes SSR a simple string concat process.
@RyanCarniato Library internals would be tricky. I wonder if there's some primitive that could make a function hydration safe, that way it can work for anything. E.g. safeHydrate(https://t.co/o5yOC5PeM6)() or safeHydrate(libraryFn)(args)
@matteocollina@julian_duque@fastifyjs that's our current setup but the trpc-style client that hono provides is very enticing. Encapsulation makes it hard to do in fastify. Is there any build system hack that could do the codegen needed?