Hacker News new | ask | show | jobs
by jneen 4704 days ago
Actually, good js implementations (like v8, for example) will only create one code object shared by all the unpack functions, with separate closures assigned to each. And since closures can (usually) be statically determined, they can use an offset lookup for the closured variable in place of a hashtable. So it's not quite as inefficient as it looks :).
1 comments

Huh, I never knew that. Thanks! As long as you're in a decent environment that kind of definition becomes a lot smoother. I like it.