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

Perf: Props in non-active internal models shouldn’t update #6

Open
JonnyOThan opened this issue Jan 6, 2020 · 4 comments
Open

Perf: Props in non-active internal models shouldn’t update #6

JonnyOThan opened this issue Jan 6, 2020 · 4 comments
Labels
performance Optimization to make it faster

Comments

@JonnyOThan
Copy link
Collaborator

If you activate ProbeControlRoom and then leave it, all the MFDs and other props continue updating every frame (note that PCR’s internal model is not instantiated until you activate it).

This might mainly be a problem in my custom build of ProbeControlRoom, but I think you could force something similar to happen in the original by activating PCR in an empty ship and then having a kerbal board and use IVA mode.

Might be some strange interaction with the transparent pod tech, where you want to see props working from external view.

This also might be something that turns out to be specific to PCR, but should investigate whether internal props in other command pods are updating while IVA mode is active in a different pod.

@JonnyOThan JonnyOThan added the performance Optimization to make it faster label Jan 6, 2020
@MOARdV
Copy link
Collaborator

MOARdV commented Jan 10, 2020

JUtil.VesselIsInIVA(Vessel) is one of the methods used to determine whether the current camera is an IVA camera or not (search the code for "InIVA" to find where RPM cares about IVA mode ATM). There are a number of IVA components that shut off because of this, but, IIRC, monitors don't due to transparent pods. Even when disabled, the prop ,odule Update() and FixedUpdate() methods get called all the time (which is one of the main reasons I developed MAS), which means there's an inordinate amount of overhead doing no-op traversals.

@JonnyOThan
Copy link
Collaborator Author

By default, ProbeControlRoom cannot be used on a manned vessel - but I have a local build which changes that. So you press C once to go to IVA, then C again to go to PCR, then C to get back to flight mode. Both PCR and "regular" IVA use the Internal camera - but the PCR monitors are updating even when still in regular IVA.

This also might pop up if you have 100 command pods and enter IVA mode in one of them - do the other 99 spend time drawing stuff?

@MOARdV
Copy link
Collaborator

MOARdV commented Jan 10, 2020

This also might pop up if you have 100 command pods and enter IVA mode in one of them - do the other 99 spend time drawing stuff?

I want to say that only the current IVA is supposed to update, but it's been a few years since I looked at the RPM code in much depth.

@JonnyOThan
Copy link
Collaborator Author

I can confirm that props in non-active IVAs are updating, via OnUpdate. Most of the RPM stuff will early-out if it's not the active part, but that can still be hundreds of props and that test isn't necessarily cheap.

Proposal: swap the list of props in the InternalModel with an empty one for parts that aren't the active one. Then none of the props will spend time updating. Swap the list back if the part becomes active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Optimization to make it faster
Projects
None yet
Development

No branches or pull requests

2 participants