Remove unneeded char[] allocations

This was causing 0.2% of allocations in a design-time build trace from a customer.
This commit is contained in:
David Kean 2017-08-02 18:59:45 +10:00
parent fdedfe93b1
commit bf58a5a060

View file

@ -11,6 +11,8 @@ namespace Microsoft.DotNet.Cli.Utils
{
public class EnvironmentProvider : IEnvironmentProvider
{
private static char[] s_pathSeparator = new char[] { Path.PathSeparator };
private static char[] s_quote = new char[] { '"' };
private IEnumerable<string> _searchPaths;
private IEnumerable<string> _executableExtensions;
@ -42,8 +44,8 @@ namespace Microsoft.DotNet.Cli.Utils
searchPaths.AddRange(Environment
.GetEnvironmentVariable("PATH")
.Split(Path.PathSeparator)
.Select(p => p.Trim('"')));
.Split(s_pathSeparator)
.Select(p => p.Trim(s_quote)));
_searchPaths = searchPaths;
}