pyo3
pyo3 copied to clipboard
use `PyIter_NextItem` during iteration
Possibly more interesting after #5660 which will show if there is any benchmark improvement here :)
Seems like there is a minor performance loss in (e.g.) set iteration. Looks like the set iterator has a remaining variable, I think we don't need that overhead because PyObject_LengthHint returns the correct thing for a set iterator. I'll try to adjust later.
For generic iterators, this does seem to be slightly faster: