emipa606 / GradualRomance

A relationship mod for Rimworld
MIT License
1 stars 1 forks source link

Stagger updating pawns in GRPawnComp::CompTick() #2

Closed thailyn closed 10 months ago

thailyn commented 10 months ago

This is half a question and half a performance suggestion, so I apologize if I'm way off.

This is regarding the code here: https://github.com/emipa606/GradualRomance/blob/3de4ced57f214e7cf22f917321c5f84992c2e432/Source/Gradual%20Romance/GRPawnComp.cs#L29-L38

Here, the two blocks are executed on a schedule relative to Find.TickManager.TicksGame. This should work fine, but, especially if there are a lot of pawns being checked (e.g., a large colony, or a large raid, even), this would lead to refreshing the cache and processing pawn relation information for every single pawn on the same tick. Could these checks be modified to incorporate the IsHashIntervalTick Pawn extension method?

Granted this only runs for spawned pawns, but a potential smoothing out of ticking pawn calculations is a potential smoothing out of ticking pawn calculations. :)

emipa606 commented 10 months ago

Good point, should be implemented now in b038562