Hacker News new | past | comments | ask | show | jobs | submit login

> That's not really true, as JS engines will already compile things with the assumption that the types won't change and "bail out" if they do.

Which makes for some great benchmarks but poor real world results.




It actually works suprisingly well.

After all, no JS engine out there would really tune their engines to benefit benchmarks at the expense of real-world performance.

Even with all the dynamic ability that something like JS gives you, most devs still create an object to store stuff, then don't change it. That means that an aggressive policy of "compile it as it is, and bail if it changes" ends up working much more often than it doesn't.

And in the cases where it doesn't, falling back to the "compile it dynamically" isn't going to be any slower than if they did that first, so it's basically a free optimization (as long as the compilation doesn't take that long).




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

Search: