[A16] Zhentar's Experimental Performance & Memory Fixes

Started by Zhentar, January 30, 2017, 03:31:21 PM

Previous topic - Next topic

RemingtonRyder

#15
World Pawn GC is pretty good. Knocked about 10MB off my save file size, anyway. :)

I should clarify that it's not a permanent reduction, but I'm sure that most of what was culled won't be missed.

Riccars

#16
Ok, I'm seeing it in the logs, I guess it only trims a couple pawns at a time, I am starting to see improvement. Speed 3 is just barely feasible now and it isn't done yet.   

edit: I'm managed to get my world pawns list list and the count is 1709 and an insane number of them are all the dead chicks/hens/chickens/etc I've butchered over the years. Like 4.5 notpad pages of living colonists and the rest is dead pawns 23/25 pages being chicks/chickens. I went into the save and manually culled out all the dead pawns save for the dead colonists in their graves and saw significant improvement (count down to 281)

GiantSpaceHamster

Just a thought regarding the WorldPawnGC. I like that RimWorld keeps these pawns around, but clearly they don't need to be updated every tick. Maybe if there was a detour that skipped updating these pawns but didn't delete them that would be a good alternative solution. Might be more work than is reasonable, but thought I'd bring it up.

kilgoar

Quote from: GiantSpaceHamster on February 02, 2017, 07:37:31 PM
Just a thought regarding the WorldPawnGC. I like that RimWorld keeps these pawns around, but clearly they don't need to be updated every tick. Maybe if there was a detour that skipped updating these pawns but didn't delete them that would be a good alternative solution. Might be more work than is reasonable, but thought I'd bring it up.

relevant dev threads:
https://ludeon.com/mantis/view.php?id=2881

https://ludeon.com/mantis/view.php?id=2879

Zhentar

Quote from: GiantSpaceHamster on February 02, 2017, 07:37:31 PM
Just a thought regarding the WorldPawnGC. I like that RimWorld keeps these pawns around, but clearly they don't need to be updated every tick. Maybe if there was a detour that skipped updating these pawns but didn't delete them that would be a good alternative solution. Might be more work than is reasonable, but thought I'd bring it up.

I'm calling this a "garbage collector" rather than just "deleter" because it doesn't just delete pawn indiscriminately. It applies more or less the same criteria that Core RimWorld does, and just tries to be more intelligent about it. A player would have to be extraordinarily attentive to notice the difference in which pawns are deleted (aside from bugs, of course). So this aims to reduce the performance impact without affecting the gameplay.

Optimizing the cost of ticking the pawns is not as straightforward and it might seem. Simply halting the ticking entirely has some weird consequences; for example, raiders returning a second time would have the same fresh, still bleeding wounds that they left the map with. There are ways to work around that, of course, but the complexity grows quite quickly and it would be hard to preserve mod compatibility. I am likely to dig into the ticking performance further at some point, but I don't think optimizing it will have particularly good returns.


BlackGyver

Significant improvements since I've started using this mod, but some issues remain; dead colony animals (which could probably be culled from the files if not buried somewhere); there's a lot of them still stored!

Is there also a possibility you'd look into lightening the load of idle pawns? They seem to take a lot of processing power for some reason!

Thanks again for that wonderful mod!

Riccars

Quote from: BlackGyver on February 05, 2017, 04:31:42 AM
Significant improvements since I've started using this mod, but some issues remain; dead colony animals (which could probably be culled from the files if not buried somewhere); there's a lot of them still stored!

Is there also a possibility you'd look into lightening the load of idle pawns? They seem to take a lot of processing power for some reason!

Thanks again for that wonderful mod!

I saw the same issue. My meat source is 15 hens constantly laying eggs then butchering the chicks and most of my massive dead pawn list was all the chicks over less than 3 years.

Pichu0102

Quote from: Zhentar on February 03, 2017, 12:48:55 AM
Quote from: GiantSpaceHamster on February 02, 2017, 07:37:31 PM
Just a thought regarding the WorldPawnGC. I like that RimWorld keeps these pawns around, but clearly they don't need to be updated every tick. Maybe if there was a detour that skipped updating these pawns but didn't delete them that would be a good alternative solution. Might be more work than is reasonable, but thought I'd bring it up.

I'm calling this a "garbage collector" rather than just "deleter" because it doesn't just delete pawn indiscriminately. It applies more or less the same criteria that Core RimWorld does, and just tries to be more intelligent about it. A player would have to be extraordinarily attentive to notice the difference in which pawns are deleted (aside from bugs, of course). So this aims to reduce the performance impact without affecting the gameplay.

Optimizing the cost of ticking the pawns is not as straightforward and it might seem. Simply halting the ticking entirely has some weird consequences; for example, raiders returning a second time would have the same fresh, still bleeding wounds that they left the map with. There are ways to work around that, of course, but the complexity grows quite quickly and it would be hard to preserve mod compatibility. I am likely to dig into the ticking performance further at some point, but I don't think optimizing it will have particularly good returns.
What about deep freezing unimportant pawns, then before a raid or other event that spawns pawns, unfreezing some of them and catching them up in the background before starting the raid or event? I mean, this is less directed towards you and is more a general suggestion for the vanilla game.

crusader2010

Hello. I've tried the WorldPawnGC mod and found an issue with reloading games. Due to this I had to disable it.

I've attached a section of the output_log.txt related to the last attempt at loading a saved game. I always got an error before the assets loaded.

Did manage to fix it though: searched for all the "could not resolve reference" and "could not load reference" IDs from the log in the Autosave-4.txt file and removed them. Then the saved game worked again! Note that it was not only pawn IDs that made the issue occur, but also drug sets IDs.

I suppose the NullReferenceExceptions are related to these.

[attachment deleted by admin due to age]
My mod pack: {A13} Mod Mega Pack

Pichu0102

Just a heads up, but once you save a game with WorldPawnGC, disabling it causes the world pawn list debug option to fail until you re-enable WorldPawnGC. Just a heads up if someone else was thinking they could just enable it from time to time when it got slow and disable it to keep pawns around who have visited more.

https://gist.github.com/HugsLibRecordKeeper/c92e7dfca6b5862de328aa5970cd86d9#file-output_log-txt-L938

(Lower I started a new colony to test if having it disabled on a new colony worked, it did)

Zhentar

The world pawn list debug option fails before you install WorldPawnGC too; it's just okay in your test game because there aren't any world pawns that could cause the crash yet (factionless pawns). The reason it works while WorldPawnGC is enabled is because WorldPawnGC detours the world pawn list debug code with a fixed version.


cap75

Quote from: Riccars on February 05, 2017, 09:35:00 PM
Quote from: BlackGyver on February 05, 2017, 04:31:42 AM
Significant improvements since I've started using this mod, but some issues remain; dead colony animals (which could probably be culled from the files if not buried somewhere); there's a lot of them still stored!

Is there also a possibility you'd look into lightening the load of idle pawns? They seem to take a lot of processing power for some reason!

Thanks again for that wonderful mod!

I saw the same issue. My meat source is 15 hens constantly laying eggs then butchering the chicks and most of my massive dead pawn list was all the chicks over less than 3 years.

Similar issue: I once sold a 4 pegged boomalope (boomalope 10) to a caravan, a few seasons after boom10 was back in the wild. So living animals are also tracked.

SpaceDorf

It instantly removed zoom-out slow down after being installed.
Awesome work man.
Maxim 1   : Pillage, then burn
Maxim 37 : There is no overkill. There is only open fire and reload.
Rule 34 of Rimworld :There is a mod for that.
Avatar Made by Chickenplucker