Skip to content

Comments

PR: Avoid looping on large numpy arrays#1397

Closed
impact27 wants to merge 2 commits intohgrecco:masterfrom
impact27:patch-4
Closed

PR: Avoid looping on large numpy arrays#1397
impact27 wants to merge 2 commits intohgrecco:masterfrom
impact27:patch-4

Conversation

@impact27
Copy link
Contributor

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

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.
@impact27
Copy link
Contributor Author

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

@andrewgsavage
Copy link
Collaborator

done this in #1987

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants