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

Optimizations for DerivativeBinder #72

Merged
merged 5 commits into from
Feb 11, 2022

Conversation

alexfikl
Copy link
Collaborator

@alexfikl alexfikl commented Nov 15, 2021

The commits should be fairly self-contained. The changes are

  • Use tuple([...]) over tuple(generator), since it's a bit faster and some of these get called a lot.
  • Return original expressions if nothing changed in geometric_algebra.mappers.
  • Add an early exit in DerivativeBinder.map_product if it didn't find any nablas.

The only change that had a visible effect (i.e > 1s) was the second one. The main culprit was the hashing and equality comparisons for the various caches and that helped hit the self is other case more often and avoid the expensive checks.

@inducer
Copy link
Owner

inducer commented Feb 11, 2022

LGTM, thanks!

@inducer inducer enabled auto-merge (rebase) February 11, 2022 05:44
@inducer inducer merged commit eda2dbf into inducer:main Feb 11, 2022
@alexfikl alexfikl deleted the micro-optimizations branch February 11, 2022 15:16
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