Avoid excessive TrimExcess()

It's really good for keeping memory low, but due to limited lifespan of those objects and the fact that we should focus on performance and not memory, it's better to avoid extra overhead and let GC do it's job, by dropping references to those objects ASAP

TrimExcess() is still being used for global objects, as those have longer (possibly infinite) lifespan and can benefit from that.
This commit is contained in:
JustArchi
2016-07-08 06:45:10 +02:00
parent 412028eff7
commit 09b2b29ff4
3 changed files with 0 additions and 6 deletions

View File

@@ -101,7 +101,6 @@ namespace ArchiSteamFarm {
}
if (tradeOffers.RemoveWhere(tradeoffer => IgnoredTrades.Contains(tradeoffer.TradeOfferID)) > 0) {
tradeOffers.TrimExcess();
if (tradeOffers.Count == 0) {
return;
}
@@ -211,7 +210,6 @@ namespace ArchiSteamFarm {
// Now remove from our inventory all items we're NOT interested in
inventory.RemoveWhere(item => !appIDs.Contains(item.RealAppID));
inventory.TrimExcess();
// If for some reason Valve is talking crap and we can't find mentioned items, assume OK
if (inventory.Count == 0) {