3 ms·
> 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_ d
by commandlinefan 10mo ago
> 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.
- astrange 10mo agoA JIT can do any optimization it wants, as long as it can deoptimize if it turns out it was wrong.
- LoganDark 10mo agoCould this perhaps be it? https://janvitek.org/pubs/ecoop11.pdf https://janvitek.org/pubs/ecoop11.pdf
- cibyr 10mo agoThe 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/Reference/Global_Objects/eval#direct_and_indirect_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-considered-crazy https://wingolog.org/archives/2012/01/12/javascript-eval-con...