News for hackers. Stuff that matters.
Re:Is eval evil? Just-in-time compiling by tobr on Monday November 19, 2018 @12:15PM (#18487875)
Can eval ever increase performance? I’m thinking that for some types of abstractions you can end up with highly nested, indirect calls, and if you can instead generate new code as needed, maybe it could speed things up? Are there any mainstream examples of this?
Re:Is eval evil? Just-in-time compiling by __s on Monday November 19, 2018 @12:24PM (#18487943)
Re:Is eval evil? Just-in-time compiling by hyperpape on Monday November 19, 2018 @12:46PM (#18488132)
I think the Python falcon web server uses eval to produce direct python that executes routing code at run time. I don't have any reason to think it can't be beat, but it is relatively fast for something done in Python.

More generally, generating code is used for a lot of regex engines, though it may happen before runtime.

Re:Is eval evil? Just-in-time compiling by nine_k on Monday November 19, 2018 @01:01PM (#18488282)
This looks like a compilation step. If you cannot have your language implementation generate some kind of optimized code statically, you can do it yourself dynamically.
Re:Is eval evil? Just-in-time compiling by Veedrac on Monday November 19, 2018 @12:38PM (#18488086)
Python uses/used eval for namedtuple at least in part for performance.
Re:Is eval evil? Just-in-time compiling by xapata on Monday November 19, 2018 @02:33PM (#18489008)
Used. Raymond revised the implementation.