A code solution to mass variable instantiation in structures and ships
To be honest, this is a solution I pose that can solve several separate issues and can also be used to implement a few good change to this games general design. It is a feature suggestion, but one that involves coding. I have not seen anything like it here, and I can only hope that I am posting this in the correct place. I believe this suggestion would vastly improve the efficiency of the code within Space Engineers if used. However, I am unfamiliar with this product's inner workings, and thus cannot implement it myself through modding, and cannot investigate much further into the program without such knowledge.
The idea is to remove block-by-block variables for certain types of blocks, and consolidate them as "ship variables" that are part of the instance of the ship itself.
Such a system would also be a great addition to the UI, but that is a separate issue.
Prime candidates for this are batteries, so I will use them as my example on how this would work.
The Battery's variables from the menu include (I am not using the correct names, because I forgot them):
(I hope I did not redact or add any by mistake)
In addition, there are variables for structural integrity, mass, and more, but let us leave them to the side for now.
In a ship with 40 Battery blocks, the amounts to 120 variables that need to frequently update and 120 bools that infrequently update, but are likely checked frequently by the ship's power.
My suggestion is that instead of these 240 total variables, reduce the variables by consolidating Batteries into one instance.
Instead, the ship will know "I have 40 Batteries" instead of "I have 40 separate instances of Battery".
The ship will tally how many batteries it has, and then calculate the above variables.
This can reduce variable instances for all batteries down to a single set of numbers such as the following:
1 variable for number of batteries (integer)
and 1 instance of each of the previously mentioned variables from above.
These variables will be tied to the instance of the ship itself, and not to the battery blocks.
This can also be applied to other blocks, and you seem to have done this with blocks related to physics, such as thrusters and gyroscopes, but only for controlling the ship's movement.
Blocks that are heavily reliant on code such as batteries require simplification, and this may be the solution you need.
I hope the above helps in some way. I decided to create this account only to solve this issue. My computer gets lag issues due to such coding, even though it far exceeds the specs, because the above coding concerns are hogging RAM and CPU power.