Ok, so the issue is that new Function can't access upvars, and we need to access upvars for speed here? In that case it does seem like we need to use eval?

People have asked for an option to disable eval so that emscripten code can work as-is in packaged apps. I'm not opposed to someone adding such an option. It would necessarily disable some things, though, like I guess embind.