pint icon indicating copy to clipboard operation
pint copied to clipboard

PR: Avoid looping on large numpy arrays

Open impact27 opened this issue 4 years ago • 1 comments

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-files with no errors
  • [ ] The change is fully covered by automated unit tests
  • [ ] Documented in docs/ as appropriate
  • [ ] Added an entry to the CHANGES file

impact27 avatar Oct 20 '21 13:10 impact27

Not exactly a benchmark, but I have one function that went from 16s to 2s execution

impact27 avatar Oct 20 '21 13:10 impact27