TriggerAu / KerbalAlarmClock

A time management and utility plugin for Kerbal Space Program
MIT License
182 stars 53 forks source link

KAC makes the fps drop in Tracking Station #207

Closed Gordon-Dry closed 5 years ago

Gordon-Dry commented 6 years ago

KSP 1.4.5 x64

After suffering for a few months about very low fps in Tracking Station I dared to do the hard way today and to start with stock and a new career and add one mod (+ dependencies) after another until the fps drop in Tracking Station occurs.

I found out that KAC is the culprit.

The drop in a barely modded install with CRP, ContractConfigurator, Kerbalism and RemoteTech is already down to 32 fps; when adding KCT, ScrapYard and MonthlyBudgets it's already down to 12 fps (no single exception in the log!) and in my actual full modded install it's down to 4 fps.

I would say because KAC is an indispensable mod this really needs some tinkering.

Gordon-Dry commented 6 years ago

I can confirm, with my full install the fps in Tracking Station is only down to 52 fps without KAC which is okay when you consider this:

Mod DLLs found:
Stock assembly: Assembly-CSharp v0.0.0.0
Hyperspace v1.0.0.0
ModuleManager v3.0.7.0
ClickThroughBlocker v0.1.6.7 / v1.0.0.0
FilterExtensions v3.2.2.9 / v1.0.0.0
TexturesUnlimited v0.0.0.0
aaa_Toolbar v1.7.17.11
USITools v1.0.0.0
ToolbarControl v0.1.6.16 / v1.0.0.0
ABCORS v0.5.0.1 / v0.4.1.0
SolverEngines v3.3.0.0 / v3.6.2.0
AJE v2.11.4.0
AllYAll v0.11.15.1 / v1.0.0.0
AnimatedDecouplers v1.4.0.10036
B9PartSwitch v2.3.3.0 / vv2.3.3
BDAnimationModules v0.6.5.4
RNModules v1.1.5.7
BetterBurnTime v1.0.0.0
BDB v1.4.3.0
Chatterer v0.9.95.2110
CCK v3.0.0.0 / v3.0.0.0 for KSP 1.4.1
CommunityTraitIcons v1.0.0.0
CLSInterfaces v1.2.0.0
ConnectedLivingSpace v1.2.6.2
ContractConfigurator v1.0.0.0 / v1.25.0
RemoteTech v1.8.0.0 / v1.8.13
CC_RemoteTech v1.0.0.0 / v1.25.0
CrewLight v1.0.6696.16498
CrewRandR v1.1.8.0 / v1.0.0.0
SimpleBoiloff v0.2.1.0
CustomBarnKit v1.1.17.0
DatedQuickSaves v1.2.3.1 / v1.1.5.0
DeadlyReentry v7.7.0.0
DecouplerShroud v1.0.0.0
DeployableEngines v2.2.0.0
AGExt v2.3.3.6 / v1.0.0.0
DiscordRP v1.0.0.0
DistantObject v1.9.1.23037
DMModuleScienceAnimateGeneric v0.20.0.0
ContractParser v1.0.8.0 / vv8.0
ProgressParser v1.0.10.0 / vv10.0
ContractsWindow v1.0.9.2 / vv9.2
ContractsWindow.Unity v1.0.9.2
DynamicBatteryStorage v1.0.0.0
EarlyBird v0.1.3.0 / v0.1.3
EarnYourStripes v1.0.0.0
EasyBoard v1.6.0.0
EditorExtensionsRedux v3.3.19.7
Atmosphere v1.4.2.2
CelestialShadows v1.4.2.2
CityLights v1.4.2.2
EVEManager v1.4.2.2
PartFX v1.4.2.2
PQSManager v1.4.2.2
ShaderLoader v1.4.2.2
Terrain v1.4.2.2
TextureConfig v1.4.2.2
Utils v1.4.2.2
_BuildManager v1.4.2.2
Firespitter v7.3.6652.37613
FShangarExtender v3.5.3.2 / v3.5.0.0
Fusebox v0.1.16.5
GPOSpeedFuelPump v1.8.15.0 / v1.8.15
HideEmptyTechTreeNodes v1.0.0.0
HotSpot v0.8.0.0 / v0.8.0
ReflectionPlugin v2.1.2.0
IndicatorLights v1.0.0.0
InterstellarFuelSwitch v3.6.12.1
Scale_Redist v1.0.0.0
JDiminishingRTG v1.5.0.0
KAS v0.6.4.0 / v0.6.4 for KSP 1.4+
MiniAVC v1.0.3.1
KAS-1.0 v1.0.6764.35927 / v1.0 Beta 11 for KSP 1.4
KSPDev_Utils.0.37 v0.37.6763.34473 / v0.37 for KSP v1.4+
KeepItStraight v1.0.4.0
ModuleKELights v1.0.0.0
KerbalConstructionTime v0.0.0.0 / v1.4.0.69
KerbalEngineer v1.1.5.3
KerbalEngineer.Unity v1.0.0.0
KerbalGPS v1.1.0.10
KerbalismBootstrap v1.0.0.0
KerBalloons v1.0.0.0
KerboKatz.UI v1.0.1.0
KerboKatzUtilities v1.5.2.0
FPSViewer v1.5.4.0
ModifiedExplosionPotential v1.5.4.0
PhysicalTimeRatioViewer v1.5.4.0
KIS v1.14.6773.33741 / v1.14 for KSP 1.4+
KSPDev_Utils.0.37 v0.37.6763.34473 / v0.37 for KSP v1.4+
ModularFlightIntegrator v1.0.0.0 / v1.2.5.0
Kopernicus.Components v1.0.0.0
Kopernicus.OnDemand v1.0.0.0
Kopernicus.Parser v1.0.0.0
Kopernicus v1.0.0.0
KSCSwitcher v1.4.5.1
KSP-AVC v1.2.0.2
MiniAVC v1.0.3.2
KspCraftOrganizerPlugin v1.0.6716.35882
KSPWheel v0.0.0.0
LandingHeight v2.2.0.3 / v1.0.0.0
LFOBalancer v1.1.0.0
MagiCore v1.3.1.2 / v1.0.0.0 / v1.3.1.0
MechJeb2 v2.5.1.0 / vDev #804 Sarbian / v2.7.4.0
MemGraph v1.1.1.3
MonthlyBudgets v1.0.0.0
NameGenerator v1.0.0.0
NearFutureElectrical v1.0.0.0
NFPropUtils v1.0.0.0
NearFuturePropulsion v0.9.0.0
NearFutureSolar v0.4.0.0
FinalFrontier v1.0.0.0
S.A.V.E v1.0.0.0
DockingCamera v1.3.3.2 / v1.0.0.0
OrbitalSurveyPlus v2.3.5.0
PartCommanderContinued v1.1.5.0 / v1.0.3.0
PatchManager v0.0.16.0 / v1.0.0.0
PebkacLaunchEscape2 v1.4.0.1 / v1.2.2.2
PlanetShine v0.2.6.1
PortraitStats v1.0.17.0
PreciseNode v1.2.9.1 / v1.2.4.0
ProceduralFairings v1.4.5.2243 / v1.4.5.5
RCSBuildAid v0.9.7.2
RealBattery v1.0.0.0
RealChute v1.4.6811.5237 / v1.4.6.0
RealHeat v0.4.7.0
RealSolarSystem v0.14.0.0
ReentryParticleEffect v1.3.0.0
ResonantOrbitCalculator v0.0.3.2 / v1.4.4.0
RosterManager v0.2.5.1
RSSTimeFormatter v1.4.5.0
SafeChute v2.1.13.0 / v2.1.13
SCANsat v1.8.7.0 / vv18.7
SCANmechjeb v1.8.7.0 / vv18.7
SCANsat.Unity v1.8.7.0
ScienceAlert v1.9.4.2
ScienceRelay v1.0.5.1 / vv5.1
ScrapYard v1.0.0.0
ScrapYard_ContractConfigurator v1.0.0.0
SensiblePumps v1.2.6.1
SensibleScreenshot v1.2.4.1 / v1.2.4.0
ShipEffectsContinued v1.0.8.4
CLSInterfaces v1.2.0.0
ShipManifest v5.2.1.0
ScienceSituationInfo v1.3.2.0 / v1.2.1.1
SmartParts v1.9.11.0
SmokeScreen v2.8.0.0
SpaceAge v1.0.0.0
Stock assembly: KSPSteamCtrlr v0.0.1.35
StageRecovery v1.8.0.0
StationScience v1.0.0.0
Strategia v1.0.0.0 / v1.7.2
TacFuelBalancer v2.20.6792.18106
TarsierSpaceTech v7.3.0.0
TextureReplacer v3.2.0.41440
ThroughTheEyes v2.0.2.2
PJHabitat v0.1.15.3
TooManyOrbits v1.1.3.1 / v1.0.0.0
Trajectories v2.2.1.0
KSPAlternateResourcePanel v2.9.3.0
TransferWindowPlanner v1.6.3.0
UniversalStorage v1.1.4.5 / vv1.4.5
UniversalStorage.Unity v1.0.1.0
VABReorienter v1.0.0.0
VanguardTechnologies v0.1.15.2 / v1.0.0.0
WorldStabilizer v1.0.6705.1567
BuoyancyControl v1.0.2.0
Folders and files in GameData:
000_AltCustomConfigs
000_ClickThroughBlocker
000_FilterExtensions
000_FilterExtensions_Configs
000_KSPAPIExtensions
000_TexturesUnlimited
000_Toolbar
000_USITools
001_ToolbarControl
002_CommunityPartsTitles
ABCORS
Ablative-Airbrake
AFLC
AJE
AllYAll
AngleCanMods
AnimatedDecouplers
B9PartSwitch
B9_InfoDrive
BahaSP
BasicProceduralTextures
BetterBurnTime
Bluedog_DB
Bluedog_DB_Extras
BZ-1
Chatterer
ChopShop
Coatl Aerospace
CoherentContracts
Colonist
CommunityCategoryKit
CommunityResourcePack
CommunityTechTree
CommunityTraitIcons
ConnectedLivingSpace
ContractConfigurator
ContractPacks
CrewLight
CrewRandR
CryoEngines
CryoTanks
CTTP
CTTStockRebalance
CustomBarnKit
DatedQuickSaves
DeadlyReentry
DecouplerShroud
DeployableEngines
Diazo
DiscordRP
DistantObject
DMagicScienceAnimate
DMagicUtilities
DnD_Alt
DynamicBatteryStorage
EarlyBird
EarnYourStripes
EasyBoard
EditorExtensionsRedux
EnvironmentalVisualEnhancements
FASA_RCS
Fintech Industries
Firespitter
FlareReplacer
FShangarExtender
FuseboxContinued
GPOSpeedFuelPump
HeatControl
HideEmptyTechTreeNodes
HotSpot
Hubs
IndicatorLights
IndicatorLightsCommunityExtensions
InternalRCS
InterstellarFuelSwitch
JamesWebb
JDiminishingRTG
Jso
JX2Antenna
KAS
KAS-1.0
KeepItStraight
Kerbal Electric
KerbalAtomics
KerbalConstructionTime
KerbalEngineer
KerbalGPS
KerbalInventorySystemNoFun
Kerbalism
KerBalloons
Kerbalow
KerboKatz
KermangeddonIndustries
KIS
KOOSE
Kopernicus
KSCSwitcher
KSP-AVC
KspCraftOrganizer
KSPWheel
LandingHeight
LETech
LFOBalancer
MagiCore
MandatoryRCSPartPack
MechJeb2
MechJeb2 Embedded
MemGraph
ModularFlightIntegrator
MonthlyBudgets
NameGenerator
NAU
NearFutureAeronautics
NearFutureConstruction
NearFutureElectrical
NearFutureElectricaNTRs
NearFutureLaunchVehicles
NearFutureProps
NearFuturePropulsion
NearFutureSolar
NearFutureSpacecraft
Nereid
NSS
OLDD
OrbitalSurveyPlus
PartCommanderContinued
PatchManager
Pebkac
PlanetShine
PortraitStats
PreciseNode
ProceduralFairings
ProceduralFairingsRetext
RCSBuildAid
RealBattery
RealChute
RealHeat
RealPlume
RealPlume-Stock
RealSolarSystem
ReentryParticleEffect
RemoteTech
ResonantOrbitCalculator
RosterManager
RSS-Textures
RSSDateTime
RSSVE
SafeChute
SCANsat
ScienceAlert
ScienceRelay
Science_Revisited
ScrapYard
SDHI
SensiblePumpsCont
SensibleScreenshot
SETIcustomBarnKitConfig
SHED
ShipEffectsContinued
ShipManifest
SituationModuleInfo
SmartParts
SmokeScreen
SMURFF
SolverEngines
SpaceAge
SpaceY-Expanded
SpaceY-Lifters
Stock folder: Squad

SSTL
StageRecovery
StationScience
STMRibbons
Strategia
TacFuelBalancer
Taerobee
Tantares
TantaresLV
TarsierSpaceTech
TextureReplacer
ThroughTheEyes
TokamakIndustries
TooManyOrbits
Trajectories
TriggerTech
TURD
UmbraSpaceIndustries
UniversalStorage2
VABReorienter
VandestShinyStockParts
VanguardTechnologies
WorldStabilizer
XyphosAerospace
zFinal
FinalFrontier.dat
Hyperspace.dll
ModuleManager.3.0.7.dll
S.A.V.E.dat
toolbar-settings.dat
Gordon-Dry commented 6 years ago

The 52 fps were after launching the game and immediately going to Tracking Station - now, after playing for a while I even got locked 60 fps ...

Gordon-Dry commented 6 years ago

KSP 1.4.5

New career, other planets...

Adding KAC confirms the issue immediately.

I really would like to receive a reply tbh.

TriggerAu commented 6 years ago

Sorry mate - Im here, just busy on KSP atm

Ruedii commented 6 years ago

OK, anyhow, I was thinking that the best way to solve this is decrease the frequency of updates of the display windows.

Once a second should be sufficient for normal play speeds, and capping it at once every 0.25 second (4 updates a second) should be sufficient for time warp. The GUI doesn't have to update as often as the plugin's internal counter. Updating the internal counter should not take nearly as much resources as updating the UI.

Ruedii commented 6 years ago

I just thought of something.

Can you post a log sample, just to make sure it's not a mod interaction. Not many mods interact with KAC, but it's better to be sure.

It might also be a threshold issue. (Most often this is GC or other Memory Management issues with the mods, but it can also be simply too many on-frame events.)

Still, KAC could reduce it's contribution to this by using on clock based events instead of frame based ones. Even under time warp, clock granularity could be increased to one second (or higher) through prediction based behavior.

Gordon-Dry commented 6 years ago

When there is an exception thrown by KAC, this is rare:

NullReferenceException: Object reference not set to an instance of an object
  at KerbalAlarmClock.KerbalAlarmClock.UpdateDetails () [0x00000] in <filename unknown>:0 
  at KerbalAlarmClock.KerbalAlarmClock.RepeatingWorker () [0x00000] in <filename unknown>:0 
  at KSPPluginFramework.MonoBehaviourExtended.RepeatingWorkerWrapper () [0x00000] in <filename unknown>:0 

(Filename:  Line: -1)

Sometimes this:

NullReferenceException: Object reference not set to an instance of an object
  at KerbalAlarmClock.KerbalAlarmClock.FillAlarmWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUILayout+LayoutedWindow.DoWindow (Int32 windowID) [0x00000] in <filename unknown>:0 
  at UnityEngine.GUI.CallWindowDelegate (UnityEngine.WindowFunction func, Int32 id, Int32 instanceID, UnityEngine.GUISkin _skin, Int32 forceRect, Single width, Single height, UnityEngine.GUIStyle style) [0x00000] in <filename unknown>:0 

(Filename:  Line: -1)

Otherwise: KSPAlternateResourcePanel - same autor - throws exceptions:

NullReferenceException: Object reference not set to an instance of an object
  at KSPAlternateResourcePanel.KSPAlternateResourcePanel.SetAppButtonToTrue () [0x00000] in <filename unknown>:0 
  at KSPAlternateResourcePanel.KSPAlternateResourcePanel.RepeatingWorker () [0x00000] in <filename unknown>:0 
  at KSPPluginFramework.MonoBehaviourExtended.RepeatingWorkerWrapper () [0x00000] in <filename unknown>:0 

(Filename:  Line: -1)

I have recently added Undockinator to my game, so these exceptions are not the culprit at all, just to mention ...

ScrapYard throwse exceptions then and when ... also to be ignored.

As I mentioned above, the stock game + KAC make the fps already drop in Tracking Station. The more mods, the higher the drop. That doesn't mean that the other mods are faulty.

Full log, for convenience: https://www.dropbox.com/s/vbugot98jkrk7zq/2018-11-08_1%20KSP.log%20and%20stuff.7z?dl=1

TriggerAu commented 5 years ago

working on it now

TriggerAu commented 5 years ago

found an unnecessary line in the TS scene causing a findobject call that was heavy on perf. thats pulled now

also removed some other inefficiencies