Improve performance and reduce memory use and reduce array allocations by reusing char[] (#9166)

* Reduce array allocations by reusing char[]

* don't hide .Equals()

* Reduce memory use by reducing array allocations

* Revert "Reduce memory use by reducing array allocations"

This reverts commit faf6b60234167f5443435243eb52187ab07d514c.

* reuse char[] for string.split() to avoid params [] allocation
This commit is contained in:
Chad
2021-01-22 15:02:25 +13:00
committed by GitHub
parent 335c6b17b9
commit 0bd4dced0b
97 changed files with 310 additions and 167 deletions

View File

@@ -446,7 +446,7 @@ namespace Umbraco.ModelsBuilder.Embedded.Building
{
WriteNonGenericClrType(sb, type.Substring(0, p));
sb.Append("<");
var args = type.Substring(p + 1).TrimEnd('>').Split(','); // fixme will NOT work with nested generic types
var args = type.Substring(p + 1).TrimEnd(Umbraco.Core.Constants.CharArrays.GreaterThan).Split(Umbraco.Core.Constants.CharArrays.Comma); // fixme will NOT work with nested generic types
for (var i = 0; i < args.Length; i++)
{
if (i > 0) sb.Append(", ");