Skip to content

cached the algorithms in pytest #104

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

Closed
wants to merge 1 commit into from

Conversation

oliverchampion
Copy link
Collaborator

Describe the changes you have made in this PR

For speed, I've cached the Pytest algorithms such that they are not re-initiated every run. Testing is faster now. Especially good for Matlab-based testing where the Matlab engine needs initiating (different PR)

Link this PR to an issue [optional]

none

Checklist

  • [ X ] Self-review of changed code
  • [ X ] Added automated tests where applicable
  • Update Docs & Guides

For speed, I've cached the Pytest algorithms such that they are not re-initiated every run. Testing is faster now. Especially good for Matlab-based testing where the Matlab engine needs initiating (different PR)
@etpeterson
Copy link
Contributor

Two thoughts about this.

  • There already is a python cache decorator. Maybe better to use that? https://docs.python.org/3/library/functools.html
  • I'm not sure if we actually want to cache. If an algorithm has some kind of memory or learning then reusing it might bias the results. I doubt it, but we don't know how they are implemented. How much time does it save to cache in this way? Could we run more in parallel instead?

@oliverchampion
Copy link
Collaborator Author

@etpeterson, with regards to (1) I will look into this.
With regards to (2), this doesn't make a huge difference with just python code. But Matlab takes 20 seconds to initiate. If this is done for every single test point, this takes ages. Note that I only store algorithms with identical settings.
I would imagine that one would like the algorithm to remain in memory. If it does, we can fix that once it occurs?

@etpeterson
Copy link
Contributor

That is slow. I'm wondering what part of it is taking time. Do you have an example run before and after the caching? Like is it the initialization of Matlab or the algorithm itself?

@oliverchampion
Copy link
Collaborator Author

oliverchampion commented May 30, 2025 via email

@etpeterson
Copy link
Contributor

Does your other ticket make this one obsolete?

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