pint
pint copied to clipboard
PR: Avoid looping on large numpy arrays
Some numpy arrays have a dtype (such as int32) that excludes any objects. In that case, looping the array looking for a quantity is not helpful, and can waste a lot of time if the array is large.
- [ ] Closes # (insert issue number)
- [ ] Executed
pre-commit run --all-fileswith no errors - [ ] The change is fully covered by automated unit tests
- [ ] Documented in docs/ as appropriate
- [ ] Added an entry to the CHANGES file
Not exactly a benchmark, but I have one function that went from 16s to 2s execution