Skip to content

Optimizations for DerivativeBinder - #72

Merged
inducer merged 5 commits into
inducer:mainfrom
alexfikl:micro-optimizations
Feb 11, 2022
Merged

Optimizations for DerivativeBinder#72
inducer merged 5 commits into
inducer:mainfrom
alexfikl:micro-optimizations

Conversation

@alexfikl

@alexfiklalexfikl commented Nov 15, 2021

Copy link
Copy Markdown
Collaborator

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.

Comment threadpymbolic/geometric_algebra/mapper.py
@alexfikl
alexfikl marked this pull request as ready for review November 15, 2021 04:08
@alexfiklalexfikl mentioned this pull request Nov 15, 2021
11 tasks
@inducer

Copy link
Copy Markdown
Owner

LGTM, thanks!

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

@alexfikl@inducer