3 ms·
> - the two different coin sounds are played when the JIT produced a new chunk of machine code. ... as a thing for a human to listen to, it sounds like a lot i
by abeppu 2y ago
> - the two different coin sounds are played when the JIT produced a new chunk of machine code.
... as a thing for a human to listen to, it sounds like a lot is going on. But as an indicator of what's happening inside a VM in 2024, is this surprisingly slow? Especially at the intro, if you were paying close attention, you could manually count these events.
- diath 2y agoInfrequent would be a better word than slow, not all interpreted code is JITtable, and code that was JITted already will probably be cached.
- chc4 2y agoThe point of a JIT is to optimize code that is, roughly, the largest percentage of program time. Most programs follow a power distribution where there is some very important code that is ran a lot, with a lot of code that isn't ran very often (or worse, only ever once). If you JIT compile the N highest impact parts of the code, then you get the highest impact without actually needing to process that much code - which is extremely important, because the act of JIT compiling is very slow and only should be done when it's likely profitable in terms of execution time to waste so many cycles compiling code, with the expectation that you will make it back by making it N cycles faster every time it runs in the future.
- cfbolztereick 2y agoYeah, that's a good point! The 'empty' parts of the beginning of the program are actually a 'configure' phase, where the program runs a bunch of subprocesses (C compiler with small query programs) and the vm is mostly waiting for the results of that. That's why there are pauses in the coins. On the other end, I also artificially limit the samples to 10 coins a second (iirc), because if the jit is really compiling a lot it would be just too annoying.