ChrisViral / RealChute

Realistic parachutes for KSP
https://forum.kerbalspaceprogram.com/topic/52931-1
Other
47 stars 39 forks source link

Update scale optimization #4

Closed toadicus closed 10 years ago

toadicus commented 10 years ago

Optimizations for Part.GetAllChildren and ProceduralChute.UpdateScale to avoid copying lists and redundant calls to GetAllChildren. This optimization should substantially reduce the memory impact of UpdateScale, which may ameliorate some problems with very large, heavily-modded ships using RealChutes. Performance should also be boosted.

Preliminary benchmarking results using GC.GetTotalMemory in a wrapper around UpdateScale:

master_memory.log

[RealChute]: Total memory before UpdateScale: 242139136
[RealChute]: Total memory at end of UpdateScale: 250359808
[RealChute]: Total memory after UpdateScale: 250359808
[RealChute]: Total memory before UpdateScale: 250408960
[RealChute]: Total memory at end of UpdateScale: 250441728
[RealChute]: Total memory after UpdateScale: 250441728

toadicus_memory.log

[RealChute]: Total memory before UpdateScale: 241340416
[RealChute]: Total memory at end of UpdateScale: 241340416
[RealChute]: Total memory after UpdateScale: 241340416
[RealChute]: Total memory before UpdateScale: 241356800
[RealChute]: Total memory at end of UpdateScale: 241360896
[RealChute]: Total memory after UpdateScale: 241360896

Benchmarks were run in a lightly-modded install on a very small ship. More relevant benchmarking can be performed upon request.