2 ms·
That helps solve the performance issue within one execution of the surrounding function, but if the surrounding function is called many times, you're more intro
by bastawhiz 8y ago
That helps solve the performance issue within one execution of the surrounding function, but if the surrounding function is called many times, you're more introducing more closures and more indirection. Switch statements involve no allocation. Closures objects, and function calls aren't free.
- hombre_fatal 8y agoWell, in my example, the surrounding function is instantly invoked once and cannot be invoked again. It's merely a useful pattern to avoid polluting the top-level with extraction.