You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⚡️ Speed up method CodeFlashBenchmarkPlugin.pytest_collection_modifyitems by 161% in PR #59 (codeflash-trace-decorator)
## Explanation of Changes.
1. **Optimize the Loop in `pytest_collection_modifyitems` Method**.
- Instead of checking the fixture names and conditionally adding the marker within the same loop, we separate the items into two lists: one for items with the `benchmark` fixture and one for items without it.
- This optimization helps to reduce the possible overhead of repeatedly calling `add_marker` by first classifying the items and then applying the marker only to those necessary.
- Finally, we concatenate the lists to retain the original order, except with tests without benchmark fixtures getting the skip marker.
Note: The item list ordering at the end of the method may not be necessary depending on the context, but this ensures that we process markers efficiently without changing the original relative order of test items.
0 commit comments