The expression `my_list[-1]` [gets specialized](https://github.com/python/cpython/blob/70be5e42f6e288de32e0df3c77ac22a9ddf1a74b/Python/specialize.c#L1263-L1267) to `BINARY_SUBSCR_LIST_INT` every time, then it [gets deoptimized every time](https://github.com/python/cpython/blob/70be5e42f6e288de32e0df3c77ac22a9ddf1a74b/Python/bytecodes.c#L396) ~~This leads to 31%ish of `BINARY_SUBSCR_LIST_INT` executions being misses (on some programs anyway).~~ Edit: this stat was probably not accurate. Should be an easy fix. <!-- gh-linked-prs --> ### Linked PRs * gh-100189 <!-- /gh-linked-prs -->
Activity
gh-100188: Reduce misses in BINARY_SUBSCR_(LIST/TUPLE)_INT (#100189)
hauntsaninja commentedon Dec 21, 2022
Thanks for finding and fixing!
Merged main into regmachine branch (#50)