RimWorld

RimWorld

1,068 ratings
Red's Performance Fixes (aka. Comp EggLayer Fix)
11
9
12
7
3
5
5
2
3
2
2
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.4, 1.5
File Size
Posted
Updated
190.350 KB
Oct 5, 2024 @ 7:29am
Oct 6, 2024 @ 1:22am
4 Change Notes ( view )

Subscribe to download
Red's Performance Fixes (aka. Comp EggLayer Fix)

In 2 collections by RedMattis
Red's Workshop Mods
37 items
Quality of Life & Base Pack
44 items
Description
TL;DR: Less Laagggg. Game Run Better. Computer suffering less; Yay!




As of writing this just swaps out ONE very expensive Ludeon method. The... dreaded Egg laying! It really doesn't have to tick and look-up food needs every.single.tick! Gah!

I bet you're seeing the title image and thinking: Well, that's probably with a farm full of chicken over half a day, that's neat but I don- NOPE! ONE Turkey. The 40 or so pawns and animals on map but together couldn't challenge our clucking satan.

The egg method also checks every single Hediff and (every single gene if human). As well as calling on expensive (and sometimes generically patched) StatDefs, accessing the same frequently patched property several times, and so on. It's not a great comp.


After. And letting it run for a lot more ticks. Negligible amount of calls


Also after: Performance with of 77 chickens at TPS 900 (Speed 3 in RimWorld is 360TPS). This image is taken while also using various animal-related Vanilla Expanded Mods, Big & Small + all sub-mods, and Humanoid Alien Races. All of which absolutely hate the vanilla egg layer comp.



Compatibility & FAQ
No known compatibility issues. Should in theory work with just about any mod.

Confirmed to work with Rocketman, Performance Fish, etc. Highly likely to get along perfectly well with any others too.

Note that this mod only replaces egg-laying-progress-tracking using Ludeon’s standard method. Derived versions (subclasses) won’t be affected. Most mods don't subclass egg'laying though, so they will benefit from this mod.

Should be safe to add or remove from existing games.


Instructions
Likely to work best late in your modlists. That way it can patch vanilla egg-laying behavior if patched into animals by other mods.




Mod Discord
[discord.gg][ko-fi.com]
127 Comments
ryhndo Jun 2 @ 9:37pm 
@GIBBYDAMAN I thought I saw it on the sheet, and I’m using it for my next mp modlist
Head May 24 @ 1:02pm 
Thanks for this mod. I installed it and it gave me an instant 25% TPS boost, it's crazy
GIBBYDAMAN May 22 @ 6:03am 
just asking if any humans in this known world has tried this mod with multiplayer yet?
Serina Apr 24 @ 4:59am 
did Ludeon say anything about merging this fix?
The Blind One Mar 25 @ 12:38pm 
It's crazy how this gave back between ~10% to ~20% of my TPS performance on speed 3.

Went from ~260 to ~330 TPS. I do have like 30 chickens but still.
RedMattis  [author] Feb 3 @ 1:06am 
@llunak
Yeah, I know I could have transpiled it, but I was concerned that would cause more compatibility problems.

There is a real risk that others are (or will be in the future) transpiling into that method given how it works.

To date the only issue I'm aware of is the outpost one, and that is caused by them directly checking type "dalmatiner == dog" (false) instead of using an is statement "dalmatiner is dog" (true).
llunak Feb 2 @ 11:58pm 
@RedMattis: Oh, I see, I thought there was a way to get a list of all costs in one place instead of having to check all Dubs Analyzer tabs one by one :(.

BTW, you could avoid the compatibility problems (including possible future ones if the RW code changes) if instead of replacing the whole thing you just prefixed the existing function to add the 'if' and then transpilled the 1f to 1000f.
RedMattis  [author] Feb 2 @ 10:54pm 
@Victor
EggChickenUnfertilized532633 seems to be getting errors, which I guess might be due to your Egg Boxes mod. But, er, that is an egg, not an Egg Layer . I don't think I modify the actual eggs, just the creatures that lay them.

The only issue I've been aware of is the Ranch Outpost added by the fan-addon to vanilla expanded outposts. That one did a hard check for the old comp. Fixing that from their end is trivial, and I sent instructions after someone asked me about it. Dunno if that is fixed now. :)

@llunak
It is from Dub's Analyzer. When you go into a method there is an option to see what calls it and how many times.
llunak Feb 2 @ 11:50am 
Which tool was used to get the performance table (used in the first and also title images)? I don't see such a list in Dubs Performance Analyzer.
Victor Jan 8 @ 4:08pm 
Does this mod breaks Egg Boxes? I'm getting some errors with chickens and a Alpha Animals egglayer, but I also have 490 active mods so
https://gist.github.com/HugsLibRecordKeeper/f9ad20f7e31150cb4620fda5e8ed2d16