3 ms·
In addition to the other alternatives proposed here, I'm confused why it wouldn't be appropriate to use compile wrapped in a cache. Yeah, you don't want to regu
by ameliaquining 2y ago
In addition to the other alternatives proposed here, I'm confused why it wouldn't be appropriate to use compile wrapped in a cache. Yeah, you don't want to regularly call it inside the serving path, but calling it once per data type per process seems like it should be fine? It basically just increases amortized startup cost by a tiny amount.
- willseth 2y agoYeah, and you could run a warmup script on deploy so no actual users pay for it. It's not a rare pattern.
- wrigby 2y agoYeah, I came here to say the same thing. Why not just memoize compile()?
- Majromax 2y agoIt looks like the compared-to values are hard-coded into the generated function, so you would be calling compile once per unique query per process.
- ameliaquining 2y agoDoes hardcoding those values into the generated function actually speed things up? I thought the idea was just to have a distinct function per different control-flow path.