-
Notifications
You must be signed in to change notification settings - Fork 124
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
feat: speed up requires_package
using caching
#3705
Conversation
Thanks for opening a Pull Request. If you want to perform a review write a comment saying: @ansys-reviewer-bot review |
requires_package
using caching
Benchmarks:8.87s v 0.27s - 32.85x improvements. Using the test attached in this PR. Pre-changes
Post-changes (improved)
|
…ymapdl into test/testing-performance
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3705 +/- ##
==========================================
+ Coverage 87.88% 88.15% +0.27%
==========================================
Files 187 187
Lines 14710 14717 +7
==========================================
+ Hits 12928 12974 +46
+ Misses 1782 1743 -39 |
@pyansys-ci-bot LGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description
requires_package
is quite slow because of the attempt to import a package and the error handling.This is the perfect case of using
cache
wrapper to avoid executing the importing function if the response is already given. I might be able to expand this to other parts of the library.I do not expect massive performance improvements on the test library, although it is called quite a lot of times.
Issue linked
Close #3706
Checklist
draft
if it is not ready to be reviewed yet.feat: adding new MAPDL command
)draft
if it is not ready to be reviewed yet.feat: adding new MAPDL command
)