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

verify_constraints performance #3

Open
andrewshvv opened this issue Feb 17, 2021 · 3 comments
Open

verify_constraints performance #3

andrewshvv opened this issue Feb 17, 2021 · 3 comments

Comments

@andrewshvv
Copy link

andrewshvv commented Feb 17, 2021

I have noticed that the verify_constraints is the most called function. It takes about 50% of execution time, which slows down the program and development cycle for real use cases (10kb sequences).

What is the proper way to implement the caching mechanism?

@Zulko
Copy link
Member

Zulko commented Feb 18, 2021

There are several ways to up speed computations, but that depends on your project (do you have a minimal example you could share?).

The verify_constraints method is probably called on every subsequence so it is not surprising for it to be a bottleneck. The surest way to speed up computations is to use the coarse_grain/fine_grain parameters, or the A* parameter (both approaches reduce the number of subsequences evaluated, and correspond to slides 220-250 of this slideshow).

Another optimization consists in using memoize=True in CommercialDnaOffer and DnaAssemblyStation to cache the computations of price (and assembly plans) for subsequences. but that will only speed things up if you are doing multi-level assemblies, or if you are evaluating several sequences (with common subsequences) on a same supply network.

I understand that the documentation is not as good as it could be so don't hesitate if you have more questions.

@andrewshvv
Copy link
Author

Thank you @Zulko! I will try what you mentioned

@andrewshvv
Copy link
Author

To be honest, code comments helping a lot, so you are a bit humble on saying that documentation is not sufficient :)

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

No branches or pull requests

2 participants