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

avoid n^2 scaling in expand_instream #2049

Merged
merged 2 commits into from
Jan 25, 2023

Conversation

visr
Copy link
Contributor

@visr visr commented Jan 24, 2023

Before this patch, the connection set that belongs to an instream expression was found by looping over all of them. With n expressions and n connection sets, the time this took for large systems became very large (at least a day for me). This fixes that by creating a Dict that maps directly to the required connection set. This Dict is created by looping over all connection sets once.

Before this patch, the connection set that belongs to an instream expression was found by looping over all of them. With n expressions and n connection sets, the time this took for large systems became very large (at least a day for me). This fixes that by creating a Dict that maps directly to the required connection set. This Dict is created by looping over all connection sets once.
src/systems/connectors.jl Outdated Show resolved Hide resolved
@YingboMa
Copy link
Member

When adding the tests, did you make sure that they return the same expressions as before?

Co-authored-by: Yingbo Ma <mayingbo5@gmail.com>
@visr
Copy link
Contributor Author

visr commented Jan 25, 2023

Yes I ran these tests both with and without the changes, both passed.

@YingboMa YingboMa merged commit c14af36 into SciML:master Jan 25, 2023
@visr visr deleted the expand_instream branch January 25, 2023 23:41
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