From 514ffdf324b58defe98d88ce34e2d3dff53c1984 Mon Sep 17 00:00:00 2001 From: lutepickle <28810-lutepickle@users.noreply.gitgud.io> Date: Fri, 17 May 2024 19:11:22 -0700 Subject: [PATCH] Initialize some hashsets and lists to their expected capacity --- .../HediffComps/HediffComp_Menstruation.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index cdf9afd..ffb4296 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -1013,7 +1013,7 @@ namespace RJW_Menstruation float leakfactor = 1.0f; float totalleak = 0f; float cumd = TotalCumPercent; - List filthlabels = new List(); + List filthlabels = new List(cums.Count); BeforeCumOut(out Absorber absorber); if (cums.NullOrEmpty()) return; if (TotalCum > Props.maxCumCapacity * Pawn.BodySize) leakfactor = Math.Min(1 + (TotalCum - Props.maxCumCapacity * Pawn.BodySize) / 10, 2f); @@ -1045,10 +1045,10 @@ namespace RJW_Menstruation { if (cums.NullOrEmpty()) return 0; float totalleak = 0; - List filthlabels = new List(); + List filthlabels = new List(cums.Count); float outcum = 0; float cumd = TotalCumPercent; - HashSet removecums = new HashSet(); + HashSet removecums = new HashSet(cums.Count); foreach (Cum cum in cums) { float vd = cum.DismishForce(portion); @@ -1079,8 +1079,8 @@ namespace RJW_Menstruation if (cums.NullOrEmpty()) return null; Color color = GetCumMixtureColor; float totalleak = 0; - List cumlabels = new List(); - HashSet removecums = new HashSet(); + List cumlabels = new List(cums.Count); + HashSet removecums = new HashSet(cums.Count); bool pure = true; foreach (Cum cum in cums) { @@ -1370,7 +1370,7 @@ namespace RJW_Menstruation { if (eggs.NullOrEmpty()) return false; - HashSet deadeggs = new HashSet(); + HashSet deadeggs = new HashSet(eggs.Count); bool pregnant = false; foreach (Egg egg in eggs) { @@ -1574,7 +1574,7 @@ namespace RJW_Menstruation protected void EggDecay() { - HashSet deadeggs = new HashSet(); + HashSet deadeggs = new HashSet(eggs.Count); foreach (Egg egg in eggs) { egg.ageTicks += TickInterval * Configurations.CycleAcceleration;