Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> won't work if num is negative

I remember reading (although I can't find it now) a great analysis of all the optimizations that Javascript compilers _can't_ do because of the existence of the "eval" instruction.



The extra fun thing about this is that eval has different semantics if it's assigned to a different name, in order to allow JavaScript implementations to apply extra optimizations to code that doesn't call a function literally named "eval": https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

Andy Wingo (of course!) has a good explanation of this: https://wingolog.org/archives/2012/01/12/javascript-eval-con...


Could this perhaps be it? https://janvitek.org/pubs/ecoop11.pdf


A JIT can do any optimization it wants, as long as it can deoptimize if it turns out it was wrong.


You also want to prove that the „optimization“ doesn’t make things slower.


I don't think anyone actually bothers to do that tbh.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: