Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up hasElement by 2x #1621

Merged
merged 2 commits into from
Jul 1, 2023
Merged

Conversation

TimFelixBeyer
Copy link
Contributor

Instead of comparing the result of the id function between objects, we can use the built-in is operator to achieve the same in half the time. coreHasElementByMemoryLocation was only used this one time and can therefore be removed as well.

Removes coreHasElementsByMemoryLocation as it is no longer used.
use python `is` identity check instead of comparing the result of `id` between elements.
@coveralls
Copy link

Coverage Status

coverage: 92.989% (-0.002%) from 92.991% when pulling 384ed9a on TimFelixBeyer:patch-13 into f771fa7 on cuthbertLab:master.

@TimFelixBeyer
Copy link
Contributor Author

TimFelixBeyer commented Jun 27, 2023

Maybe it would make sense to add the offsetDict check to __contains__ and remove/deprecate hasElement since they contain the same functionality I believe?

@mscuthbert
Copy link
Member

happy to merge this now. I'll defer the __contains__ check until I'm off the dev sabbatical.

@mscuthbert mscuthbert merged commit 2b658aa into cuthbertLab:master Jul 1, 2023
@TimFelixBeyer TimFelixBeyer deleted the patch-13 branch July 1, 2023 10:47
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.

3 participants