StringBuilderArray 10.0.0
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
dotnet add package StringBuilderArray --version 10.0.0
NuGet\Install-Package StringBuilderArray -Version 10.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StringBuilderArray" Version="10.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StringBuilderArray" Version="10.0.0" />
<PackageReference Include="StringBuilderArray" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StringBuilderArray --version 10.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: StringBuilderArray, 10.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package StringBuilderArray@10.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StringBuilderArray&version=10.0.0
#tool nuget:?package=StringBuilderArray&version=10.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
<h1 align="center"> <a>StringBuilderArray</a> </h1>
<h3 align="center">
</h3>
Collect the resulting string without allocating memory.
Benchmark:
<details> <summary>ToString</summary>
[IterationSetup]
public void Setup()
{
_str = new string('S', StrLength);
_sb = new System.Text.StringBuilder();
for (int i = 0; i < 1000; i++)
{
_sb.AppendLine(_str);
}
_sbArr = new StringBuilderArray.StringBuilderArray();
for (int i = 0; i < 1000; i++)
{
_sbArr.AppendLine(_str);
}
}
[Benchmark(Baseline = true, Description = "StringBuilderArray")]
public void StringBuilderArray()
{
_sbArr.ToString();
}
[Benchmark(Description = "StringBuilder")]
public void StringBuilder()
{
_sb.ToString();
}
| Method | Job | Runtime | StrLength | Mean | Ratio | Allocated | Alloc Ratio |
|---|---|---|---|---|---|---|---|
| StringBuilderArray | .NET 10.0 | .NET 10.0 | 1071741 | 289,587.367 μs | 1.00 | 2093248.07 KB | 1.00 |
| StringBuilder | .NET 10.0 | .NET 10.0 | 1071741 | 318,024.700 μs | 1.10 | 2093248.07 KB | 1.00 |
| StringBuilderArray | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 292,666.936 μs | 1.00 | 2093248.07 KB | 1.00 |
| StringBuilder | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 320,468.233 μs | 1.10 | 2093248.07 KB | 1.00 |
</details> <br> <details> <summary>AppendLine</summary>
[IterationSetup]
public void Setup()
{
_str = new string('S', StrLength);
}
[Benchmark(Baseline = true, Description = "StringBuilderArray")]
public void StringBuilderArray()
{
var sb = new StringBuilderArray.StringBuilderArray();
for (int i = 0; i < 1000; i++)
{
sb.AppendLine(_str);
}
}
[Benchmark(Description = "StringBuilder")]
public void StringBuilder()
{
var sb = new System.Text.StringBuilder();
for (int i = 0; i < 1000; i++)
{
sb.AppendLine(_str);
}
}
[Benchmark(Description = "DefaultInterpolatedStringHandler")]
public void DefaultInterpolatedStringHandler()
{
var sb = new DefaultInterpolatedStringHandler();
for (int i = 0; i < 1000; i++)
{
sb.AppendLiteral(_str);
}
}
| Method | Job | Runtime | StrLength | Mean | Ratio | Allocated | Alloc Ratio |
|---|---|---|---|---|---|---|---|
| StringBuilderArray | .NET 10.0 | .NET 10.0 | 1071741 | 29.945 μs | 1.03 | 20.48 KB | 1.00 |
| StringBuilder | .NET 10.0 | .NET 10.0 | 1071741 | 123,382.045 μs | 4,229.27 | 2093438.98 KB | 102,196.87 |
| DefaultInterpolatedStringHandler | .NET 10.0 | .NET 10.0 | 1071741 | 231,279.579 μs | 7,927.77 | 2097152.02 KB | 102,378.13 |
| StringBuilderArray | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 6.277 μs | 1.02 | 20.48 KB | 1.00 |
| StringBuilder | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 126,442.383 μs | 20,631.07 | 2093440.23 KB | 102,196.93 |
| DefaultInterpolatedStringHandler | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 227,531.679 μs | 37,125.38 | 2097152.4 KB | 102,378.15 |
</details> <br> <details> <summary>AppendLine + Clear</summary>
[IterationSetup]
public void Setup()
{
_str = new string('S', StrLength);
}
[Benchmark(Baseline = true, Description = "StringBuilderArray")]
public void StringBuilderArray()
{
var sb = new StringBuilderArray.StringBuilderArray();
for (int i = 0; i < 1000; i++)
{
sb.AppendLine(_str);
}
sb.Clear();
for (int i = 0; i < 1000; i++)
{
sb.AppendLine(_str);
}
}
[Benchmark(Description = "StringBuilder")]
public void StringBuilder()
{
var sb = new System.Text.StringBuilder();
for (int i = 0; i < 1000; i++)
{
sb.AppendLine(_str);
}
sb.Clear();
for (int i = 0; i < 1000; i++)
{
sb.AppendLine(_str);
}
}
[Benchmark(Description = "DefaultInterpolatedStringHandler")]
public void DefaultInterpolatedStringHandler()
{
var sb = new DefaultInterpolatedStringHandler();
for (int i = 0; i < 1000; i++)
{
sb.AppendLiteral(_str);
}
sb.Clear();
for (int i = 0; i < 1000; i++)
{
sb.AppendLiteral(_str);
}
}
| Method | Job | Runtime | StrLength | Mean | Ratio | Allocated | Alloc Ratio |
|---|---|---|---|---|---|---|---|
| StringBuilderArray | .NET 10.0 | .NET 10.0 | 1071741 | 39.325 μs | 1.03 | 40.82 KB | 1.00 |
| StringBuilder | .NET 10.0 | .NET 10.0 | 1071741 | 233,685.746 μs | 6,141.00 | 4186788.48 KB | 102,566.30 |
| DefaultInterpolatedStringHandler | .NET 10.0 | .NET 10.0 | 1071741 | 466,345.020 μs | 12,255.03 | 2097152.02 KB | 51,375.21 |
| StringBuilderArray | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 10.092 μs | 1.01 | 40.87 KB | 1.00 |
| StringBuilder | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 240,078.979 μs | 23,996.71 | 4186789.73 KB | 102,448.69 |
| DefaultInterpolatedStringHandler | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 455,444.213 μs | 45,523.19 | 2097152.02 KB | 51,316.28 |
</details> <br> <details> <summary>Insert</summary>
[IterationSetup]
public void Setup()
{
_str = new string('S', StrLength);
}
[Benchmark(Baseline = true, Description = "StringBuilderArray")]
public void StringBuilderArray()
{
var sb = new StringBuilderArray.StringBuilderArray();
for (int i = 0; i < 100; i++)
{
sb.Append(_str);
}
sb.Insert(0, _str);
//in start
sb.Insert(100, _str);
//after 5 str from start
sb.Insert(96, _str);
}
[Benchmark(Description = "StringBuilder")]
public void StringBuilder()
{
var sb = new System.Text.StringBuilder();
for (int i = 0; i < 100; i++)
{
sb.Append(_str);
}
//before 1 str from end
sb.Insert(99 * _str.Length, _str);
//in start
sb.Insert(0, _str);
//after 5 str from start
sb.Insert(5 * _str.Length, _str);
}
| Method | Job | Runtime | StrLength | Mean | Ratio | Allocated | Alloc Ratio |
|---|---|---|---|---|---|---|---|
| StringBuilderArray | .NET 10.0 | .NET 10.0 | 1071741 | 5.069 μs | 1.02 | 1.45 KB | 1.00 |
| StringBuilder | .NET 10.0 | .NET 10.0 | 1071741 | 14,424.515 μs | 2,909.17 | 215628.59 KB | 148,389.57 |
| StringBuilderArray | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 2.073 μs | 1.01 | 1.45 KB | 1.00 |
| StringBuilder | NativeAOT 10.0 | NativeAOT 10.0 | 1071741 | 13,324.245 μs | 6,492.04 | 215629.18 KB | 148,389.97 |
</details>
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
-
net10.0
- No dependencies.
-
net5.0
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.