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

Potential fix for issue #216 #220

Merged
merged 4 commits into from
Apr 4, 2024
Merged

Potential fix for issue #216 #220

merged 4 commits into from
Apr 4, 2024

Conversation

gotmachine
Copy link
Contributor

@gotmachine gotmachine commented Mar 25, 2024

Optimization of raycasts in ModuleEngines.EngineExhaustDamage() and ModuleDeployableSolarPanel.CalculateTrackingLOS() :

  • Only synchronize transforms on the first raycast from any of those modules, mainly relevant when something else is moving transforms in between calls, which is often the case for active engines with gimbals, with a call time divided by 4-5 for ModuleEngines.FixedUpdate() when engines are actively gimballing (which is almost always the case as long as the SAS is activated)
  • Cached ScaledSpace raycast results for solar panels (alongside some other smaller optimizations) : ModuleDeployableSolarPanel.FixedUpdate() call time is divided by between 4 (when blocked by a scaled space object) and 2 (when not blocked)

On a side note, it seems there are some unrelated optimizations opportunities in ModuleDeployablePart.FixedUpdate() (which is the base class of solar panels, also shared by radiators and antennas), as when profiling (static) solar panels, the bulk of the call time was spent there doing more or less nothing. I suspect continuously (and uselessly) setting the drag cube weights is in large part responsible.

Optimization of raycasts in ModuleEngines.EngineExhaustDamage() and ModuleDeployableSolarPanel.CalculateTrackingLOS() :
- Only synchronize transforms on the first raycast from any module, mainly relevant when something else is moving transforms in between calls, which is often the case for active engines with gimbals.
- Cached ScaledSpace raycast results for solar panels : call time is divided by between 4 (when blocked by a scaled space object) and 2 (when not blocked)
@gotmachine gotmachine marked this pull request as ready for review April 4, 2024 21:53
@gotmachine gotmachine merged commit b5a4006 into dev Apr 4, 2024
1 check passed
@gotmachine gotmachine deleted the NonSynchronizedRaycasts branch April 5, 2024 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant