-
Notifications
You must be signed in to change notification settings - Fork 28
Description
When a large ship breaks it results in many different onVesselWasModified events which then in turn call out to ModuleCargoBay.onVesselModified. Each instance of this calls out to EnableShieldedVolume, which ends up recursively walking all nearby parts and their components. This is slow.
Here's some profiles showing what this ends up looking like for a large (1000 part) ship:

This one is with #355 enabled

It should be possible to defer the compute for each ModuleCargoBay until the start of the next FixedUpdate or Update call that happens immediately after. I don't think anything really needs the info this calculates until later, and by doing so we could batch together the changes to only need to happen once per cargo bay part, instead of something approaching once per cargo bay part per joint break.