Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
Open
Description
Currently, we specializeFOR_ITER for both tuple and list. We also handle tuple and lists specially inGET_ITER to support this specialization.
We should extend this specialization of iteration over sequences, using virtual iterators tobytes,str,bytesarray and others.
To do this, we should:
- Add a
tp_getiteritemslots toPyTypeObjectfor sequences that can be efficiently indexed and cannot raise except for out-of-bounds access. - Add a specialization of
FOR_ITERfor these classes. - Specialize
GET_ITERfor:- iterators
- indexable sequences (those classes with a
tp_getiteritemslot)
- Specialize
SENDfor indexable sequences which should also improve JIT coverage, as unspecialized_SENDis currently a major cause of jit optimization failures.
Combined with#145667 this will allow effective specialization of a wider range of iterables and allow that specialization not only forfor loops, but also foryield from loops.
It will add 3 instructions (4 new, 1 removed) which a reasonable