Get rid of conditional inputs and outputs for instructions in bytecodes.c #128914
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
performance
Performance or resource usage
type-feature
A feature request or enhancement
We should remove the conditional stack effects in instruction definitions in bytecodes.c
Conditional stack effects already complicate code generation and that is only going to get worse with top-of-stack caching and other interpreter/JIT optimizations.
There were two reasons for having conditional stack effects:
Reason 1 no longer applies. Instructions are much more regular now and it isn't that much work to remove the remaining conditional stack effects.
That leaves performance. I experimentally removed the conditional stack effects for
LOAD_GLOBAL
andLOAD_ATTR
which is the worse possible case for performance as it makes no attempt to mitigate the extra dispatch costs and possibly worse specialization.The results are here
Overall we see a 0.8% slowdown. It seems that specialization is not significantly worse, but there is a large increase in
PUSH_NULL
followingLOAD_GLOBAL
that appears to responsible for the slowdown. An extra specialization should fix that.Prior discussion
Linked PRs
bytecodes.c
and the code generators #128918The text was updated successfully, but these errors were encountered: