From 5f6f08e23626a3c7cc846d76d2d42e2e9ac05c6a Mon Sep 17 00:00:00 2001 From: stephentoub Date: Sun, 10 Jan 2016 15:39:37 -0500 Subject: [PATCH] Add some optimizations to AppDomain.Setup string handling - Paths are normalized from a delimited string into a delimited StringBuilder. It's very likely that the resulting data in the StringBuilder will be the same length or approximately the same length as that in the input string, So pre-size the StringBuilder to be the same as the input length. - Reuse StringBuilder instance for handling each property that needs it. - Reuse the char[] array created for the path sepator --- src/mscorlib/src/System/AppDomain.cs | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/mscorlib/src/System/AppDomain.cs b/src/mscorlib/src/System/AppDomain.cs index a672d6c..a97eddd 100644 --- a/src/mscorlib/src/System/AppDomain.cs +++ b/src/mscorlib/src/System/AppDomain.cs @@ -3623,6 +3623,8 @@ namespace System { if(propertyNames!=null && propertyValues != null) { + char[] pathSeparators = null; + StringBuilder normalisedAppPathList = null; for (int i=0; i