From ff7df55e5c1ae622ccc6b7cdfb5caaff302e5883 Mon Sep 17 00:00:00 2001 From: Rune Nielsen Date: Mon, 12 Aug 2024 13:10:02 +0200 Subject: [PATCH] reduce the amount of memory allocations (#134) --- .../Reporting/CustomerTerminationReport.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/OpenFTTH.APIGateway/Reporting/CustomerTerminationReport.cs b/OpenFTTH.APIGateway/Reporting/CustomerTerminationReport.cs index 8dbebb1..585a053 100644 --- a/OpenFTTH.APIGateway/Reporting/CustomerTerminationReport.cs +++ b/OpenFTTH.APIGateway/Reporting/CustomerTerminationReport.cs @@ -327,16 +327,13 @@ private List GetCsvLinesFromTraceResult(List() { "no installations found" }; - var resultCsvLines = new List(); + var resultCsvLines = new List(traces.Count); - var firstObject = traces.First(); - - var myType = firstObject.GetType(); - var props = new List(myType.GetProperties().Reverse()); + var myType = traces.First().GetType(); var csvHeader = ""; - foreach (PropertyInfo prop in props) + foreach (PropertyInfo prop in myType.GetProperties().Reverse()) { if (csvHeader != "") csvHeader += ";"; @@ -352,7 +349,7 @@ private List GetCsvLinesFromTraceResult(List