This PR slightly changes how we store and access call frames in the vm. In addition to the frames stack, there is now a frame field that always holds the current call frame. The main reason for this is, so that we can avoid panic checks in critical paths.
I also removed some duplicate calls to Vm::frame and Vm::fram_mut and grouped them where possible. This should not be that relevant anymore, since now it's just a field access.
Here two graphs to visualize the change. These are running in dev profile so functions are visible. Here the bigger impact seems to actually be the deref of the frames vec, but I'm not sure if the actual cost in release looks different.
Before:
After:
And here some benchmarks. I did not run them multiple times, the impact seems a bit high to me:
Before:
RESULT Richards 55.7
RESULT DeltaBlue 57.8
RESULT Crypto 67.7
RESULT RayTrace 187
RESULT EarleyBoyer 174
RESULT RegExp 60.4
RESULT Splay 192
RESULT NavierStokes 155
SCORE 103
After:
RESULT Richards 59.1
RESULT DeltaBlue 59.7
RESULT Crypto 72.5
RESULT RayTrace 197
RESULT EarleyBoyer 182
RESULT RegExp 60.0
RESULT Splay 189
RESULT NavierStokes 172
SCORE 108
This PR slightly changes how we store and access call frames in the vm. In addition to the
frames
stack, there is now aframe
field that always holds the current call frame. The main reason for this is, so that we can avoid panic checks in critical paths.I also removed some duplicate calls to
Vm::frame
andVm::fram_mut
and grouped them where possible. This should not be that relevant anymore, since now it's just a field access.Here two graphs to visualize the change. These are running in
dev
profile so functions are visible. Here the bigger impact seems to actually be the deref of theframes
vec, but I'm not sure if the actual cost inrelease
looks different.Before:![image](https://github.com/boa-dev/boa/assets/32105367/79ab0e53-a205-4a73-a2c2-e5dc2833d5a9)
After:![image](https://github.com/boa-dev/boa/assets/32105367/74a00cba-bf1d-4402-be9d-5210b5689d2d)
And here some benchmarks. I did not run them multiple times, the impact seems a bit high to me:
Before:
After: