4 ms·
I doubt it hurt performance, self-modifying code must play havoc on all the modern CPU caches, branch prediction, instruction decoding etc… A jit makes it worth
by xavxav 4y ago
I doubt it hurt performance, self-modifying code must play havoc on all the modern CPU caches, branch prediction, instruction decoding etc… A jit makes it worthwhile by doing it for hot paths for which the payoff outweighs this cost (or attempts to).
- amelius 4y agoIt will definitely hurt performance (to remove JIT functionality), otherwise why would JIT compilation be even used?
- simjnd 4y agoI may be wrong, but I think it goes something like this: Languages that benefit from JIT compilation are languages with a dynamic type system: the JIT profiles the hot paths to optimize (e.g. this function is called a lot with integer parameters but only once with string parameters, so I'm going to compile the version with ints to optimal code and compile the string version to a suboptimal but inexpensive code) Go on the other hand has a static type system, so when you AOT compile it can already produce all the optimal code needed thanks to static types.
- amelius 4y agoYes, this was already noted a few comments above: https://news.ycombinator.com/item?id=33394615 https://news.ycombinator.com/item?id=33394615 Type information is not the only thing that helps though. Partial specialization can be applied to other things.