pytest
153a436b - [8.2.x] fixtures: fix catastrophic performance problem in `reorder_items`

Commit
1 year ago
[8.2.x] fixtures: fix catastrophic performance problem in `reorder_items` Manual minimal backport from commit e89d23b24741c001e8651a77303992cfa41c1664. Fix #12355. In the issue, it was reported that the `reorder_items` has quadratic (or worse...) behavior with certain simple parametrizations. After some debugging I found that the problem happens because the "Fix items_by_argkey order" loop keeps adding the same item to the deque, and it reaches epic sizes which causes the slowdown. I don't claim to understand how the `reorder_items` algorithm works, but if as far as I understand, if an item already exists in the deque, the correct thing to do is to move it to the front. Since a deque doesn't have such an (efficient) operation, this switches to `OrderedDict` which can efficiently append from both sides, deduplicate and move to front.
Author
Committer
Parents
Loading