-
Notifications
You must be signed in to change notification settings - Fork 22
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
Remove variables not referenced by input or output variables #1
Comments
Just noting that sometimes there are used to calculate a UI variable. Not sure this is critical feature to implement, and could remove a variable expected for UI. |
Yes, we tried this and that turned out to be an issue. A better approach would be a more general "tree-shaking" algorithm that works backward from the list of output variables and drops everything that is not a dependency. That would include display variables and also drop variables that are not contributing to outputs we are interested in. |
How do we determine which vars are used in graphs? Would this be a manual list since we don’t parse the UI elements of the MDL now?
Off-topic: I don’t know if memory requirements are limiting our speed, but we don’t need arrays for all the model variables if we only care about a small subsets of output variables. I think C memory allocation is fast (right?), but might be more of an issue in JavaScript (Sarah had an email thread on this). For most variables we only need two values at a time.
… On Jul 24, 2017, at 12:04 PM, Todd Fincannon ***@***.***> wrote:
Yes, we tried this and that turned out to be an issue. A better approach would be a more general "tree-shaking" algorithm that works backward from the list of output variables and drops everything that is not a dependency. That would include display variables and also drop variables that are not contributing to outputs we are interested in.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ALCXqB5qrZ7zw9XX1GYjpawWPMAIK4ksks5sRM6LgaJpZM4Lrtr5>.
|
When we generate the model in SDEverywhere, we give a list of input and output variables in the spec JSON file. All the graph and table variables appear as output variables. Memory allocation time is almost certainly not affecting our performance much compared to calculations. It is also a one-time startup cost. |
We should be clear about what execution environment we’re talking about. I agree that for C what you said is likely correct. Memory allocation might still be a problem in JS. Did you mean your comments to apply to both?
… On Jul 24, 2017, at 12:46 PM, Todd Fincannon ***@***.***> wrote:
When we generate the model in SDEverywhere, we give a list of input and output variables in the spec JSON file. All the graph and table variables appear as output variables.
Memory allocation time is almost certainly not affecting our performance much compared to calculations. It is also a one-time startup cost.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#1 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ALCXqAAkvFlXubSopvl9YSbZwEEBdOKsks5sRNhngaJpZM4Lrtr5>.
|
yes
On Tue, Jul 25, 2017, at 19:15, travisf-ci wrote:
We should be clear about what execution environment we’re talking about. I agree that for C what you said is likely correct. Memory allocation might still be a problem in JS. Did you mean your comments to apply to both?>
> On Jul 24, 2017, at 12:46 PM, Todd Fincannon ***@***.***> wrote:> >
> When we generate the model in SDEverywhere, we give a list of input and output variables in the spec JSON file. All the graph and table variables appear as output variables.> >
> Memory allocation time is almost certainly not affecting our performance much compared to calculations. It is also a one-time startup cost.> >
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub <#1 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ALCXqAAkvFlXubSopvl9YSbZwEEBdOKsks5sRNhngaJpZM4Lrtr5>.> >
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub[1], or mute the thread[2]. >
|
I'm reviving this old issue and changing the title to align with Todd's notes in this comment. Recently I was trying to process a larger model using SDE and noticed that SDE wasn't already eliminating variables that are not relevant to the set of input and output variables from the spec file. SDE already does most of the reference tracking that we need for this. To make it complete, we just need to fix a couple places where references were not being recorded, and then add a step just before code generation to eliminate variables that are not in the set of active references. |
Here are the numbers that show the benefits of this change using the En-ROADS model (v2.7.29) as a real world test case, and relative to other recent performance work. The benefits depend on how many variables the model contains that aren't referenced by the input/output variables listed in the spec file. In the case of En-ROADS, there were quite a few subtrees and lookups not needed for the final app, so the total code size and runtime decreased significantly with this change. PerformanceMacBook Pro (2019) | 2.4 GHz 8-core i9, 32 GB RAM, macOS 10.15 Safari:
Chrome:
Firefox:
iPhone 8 | A11, iOS 13
iPad Air (2013) | A7, iOS 12
Size
Legend
|
No description provided.
The text was updated successfully, but these errors were encountered: