Use Apend(char) instead of Apend(string) for performance

When calling StringBuilder.Append with a unit length string, consider using a const char rather than a unit length const string to improve performance.
This commit is contained in:
Qstick 2023-01-09 22:10:57 -06:00
parent e805f61450
commit 7521579bca
3 changed files with 7 additions and 8 deletions

View File

@ -194,7 +194,6 @@ dotnet_diagnostic.CA1819.severity = suggestion
dotnet_diagnostic.CA1822.severity = suggestion
dotnet_diagnostic.CA1823.severity = suggestion
dotnet_diagnostic.CA1824.severity = suggestion
dotnet_diagnostic.CA1834.severity = suggestion
dotnet_diagnostic.CA1839.severity = suggestion
dotnet_diagnostic.CA1840.severity = suggestion
dotnet_diagnostic.CA1845.severity = suggestion

View File

@ -27,7 +27,7 @@ namespace NzbDrone.Common.Http
if (scheme.IsNotNullOrWhiteSpace())
{
builder.Append(scheme);
builder.Append(":");
builder.Append(':');
}
if (host.IsNotNullOrWhiteSpace())
@ -36,7 +36,7 @@ namespace NzbDrone.Common.Http
builder.Append(host);
if (port.HasValue)
{
builder.Append(":");
builder.Append(':');
builder.Append(port);
}
}
@ -202,11 +202,11 @@ namespace NzbDrone.Common.Http
{
if (builder.Length != 0)
{
builder.Append("&");
builder.Append('&');
}
builder.Append(Uri.EscapeDataString(pair.Key));
builder.Append("=");
builder.Append('=');
builder.Append(Uri.EscapeDataString(pair.Value));
}

View File

@ -234,19 +234,19 @@ namespace NzbDrone.Core.Extras.Subtitles
if (multipleCopies)
{
suffixBuilder.Append(".");
suffixBuilder.Append('.');
suffixBuilder.Append(copy);
}
if (language != Language.Unknown)
{
suffixBuilder.Append(".");
suffixBuilder.Append('.');
suffixBuilder.Append(IsoLanguages.Get(language).TwoLetterCode);
}
if (languageTags.Any())
{
suffixBuilder.Append(".");
suffixBuilder.Append('.');
suffixBuilder.Append(string.Join(".", languageTags));
}