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

Cache Basix elements to avoid computing basis functions multiple times #472

Merged
merged 4 commits into from
Apr 20, 2022

Conversation

mscroggs
Copy link
Member

I put a print in the basix::FiniteElement initialisation. When compiling a form, each element was being created multiple times:

image

After this PR, each element is only computed twice (once by FFCx, and once by DOLFINx):

image

For higher degree elements, this will speed up compilation of forms by a fair amount

@michalhabera
Copy link
Contributor

michalhabera commented Apr 12, 2022

Could you just use cache decorator from functools?

@mscroggs
Copy link
Member Author

Could you just use cache decorator from functools?

I did not know this existed, thanks!

@mscroggs mscroggs merged commit 37fb30c into main Apr 20, 2022
@mscroggs mscroggs deleted the mscroggs/create_element_once branch April 20, 2022 07:01
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