Initialize some hashsets and lists to their expected capacity

This commit is contained in:
lutepickle 2024-05-17 19:11:22 -07:00
parent 64923264b9
commit 514ffdf324
1 changed files with 7 additions and 7 deletions

View File

@ -1013,7 +1013,7 @@ namespace RJW_Menstruation
float leakfactor = 1.0f;
float totalleak = 0f;
float cumd = TotalCumPercent;
List<string> filthlabels = new List<string>();
List<string> filthlabels = new List<string>(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<string> filthlabels = new List<string>();
List<string> filthlabels = new List<string>(cums.Count);
float outcum = 0;
float cumd = TotalCumPercent;
HashSet<Cum> removecums = new HashSet<Cum>();
HashSet<Cum> removecums = new HashSet<Cum>(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<string> cumlabels = new List<string>();
HashSet<Cum> removecums = new HashSet<Cum>();
List<string> cumlabels = new List<string>(cums.Count);
HashSet<Cum> removecums = new HashSet<Cum>(cums.Count);
bool pure = true;
foreach (Cum cum in cums)
{
@ -1370,7 +1370,7 @@ namespace RJW_Menstruation
{
if (eggs.NullOrEmpty()) return false;
HashSet<Egg> deadeggs = new HashSet<Egg>();
HashSet<Egg> deadeggs = new HashSet<Egg>(eggs.Count);
bool pregnant = false;
foreach (Egg egg in eggs)
{
@ -1574,7 +1574,7 @@ namespace RJW_Menstruation
protected void EggDecay()
{
HashSet<Egg> deadeggs = new HashSet<Egg>();
HashSet<Egg> deadeggs = new HashSet<Egg>(eggs.Count);
foreach (Egg egg in eggs)
{
egg.ageTicks += TickInterval * Configurations.CycleAcceleration;