pymmcore-plus / useq-schema

An implementation agnostic schema for describing a sequence of events during a multi-dimensional imaging acquisition.
https://pymmcore-plus.github.io/useq-schema/
BSD 3-Clause "New" or "Revised" License
15 stars 5 forks source link

perf: significantly speedup iteration of MDASequences. (breaking change, removes `__len__` methods) #113

Closed tlambert03 closed 1 year ago

tlambert03 commented 1 year ago

this PR dramatically speeds up iteration of MDASequences (~4-26 times faster, depending on whether positions have subsequences or not).

It removes all of the __len__ methods however. (they never should have been there to begin with, that was a bad choice on my part). We'll see if it breaks downstream libraries.

Note that this also reverts #78 ... which had negative performance implications

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 98.14% and project coverage change: -0.22% :warning:

Comparison is base (c3f0042) 96.72% compared to head (a8dc6c0) 96.50%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #113 +/- ## ========================================== - Coverage 96.72% 96.50% -0.22% ========================================== Files 13 13 Lines 732 716 -16 ========================================== - Hits 708 691 -17 - Misses 24 25 +1 ``` | [Files Changed](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus) | Coverage Δ | | |---|---|---| | [src/useq/\_grid.py](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX2dyaWQucHk=) | `100.00% <ø> (ø)` | | | [src/useq/\_channel.py](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX2NoYW5uZWwucHk=) | `92.59% <50.00%> (-3.71%)` | :arrow_down: | | [src/useq/\_base\_model.py](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX2Jhc2VfbW9kZWwucHk=) | `87.50% <100.00%> (-1.53%)` | :arrow_down: | | [src/useq/\_iter\_sequence.py](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX2l0ZXJfc2VxdWVuY2UucHk=) | `100.00% <100.00%> (ø)` | | | [src/useq/\_mda\_event.py](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX21kYV9ldmVudC5weQ==) | `85.71% <100.00%> (-0.73%)` | :arrow_down: | | [src/useq/\_mda\_sequence.py](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX21kYV9zZXF1ZW5jZS5weQ==) | `97.39% <100.00%> (-0.11%)` | :arrow_down: | | [src/useq/\_time.py](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX3RpbWUucHk=) | `98.11% <100.00%> (-1.89%)` | :arrow_down: | | [src/useq/\_utils.py](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX3V0aWxzLnB5) | `100.00% <100.00%> (+3.84%)` | :arrow_up: | | [src/useq/\_z.py](https://app.codecov.io/gh/pymmcore-plus/useq-schema/pull/113?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=pymmcore-plus#diff-c3JjL3VzZXEvX3oucHk=) | `98.21% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.