|
|
|
|
|
by zahlman
103 days ago
|
|
I mean, I think that probably is what happens. But then, while it's sped up a lot, the generated bytecode presumably also includes instructions to try the cast and raise that exception when it fails. (And the possible "JIT hotpath optimization" could be something like, at the bottom level, branch-predicting that cast.) |
|
I haven't actually inspected the emitted bytecode, so I was only reasoning from the observed speedup.
Your point about branch prediction is really interesting; it would explain how the cast becomes almost free once the type is stable in the hot path.
I'm learning a lot from this thread -- thank you for pushing on the details!