https://github.com/bervproject/stringbuilderperformance
String Builder Performance
https://github.com/bervproject/stringbuilderperformance
Last synced: 4 months ago
JSON representation
String Builder Performance
- Host: GitHub
- URL: https://github.com/bervproject/stringbuilderperformance
- Owner: bervProject
- License: mit
- Created: 2023-08-05T05:31:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-12T10:45:51.000Z (over 1 year ago)
- Last Synced: 2024-12-29T05:32:13.208Z (about 1 year ago)
- Language: C#
- Size: 15.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# StringBuilderPerformance
String Builder Performance
## Summary
| Method | N | Mean | Error | StdDev | Median | Rank | Gen0 | Gen1 | Gen2 | Allocated |
|------------------------- |------- |-----------------:|---------------:|---------------:|-----------------:|-----:|--------------:|--------------:|--------------:|----------------:|
| AppendWithStringBuilder | 1000 | 10.45 us | 0.207 us | 0.548 us | 10.20 us | 1 | 8.7585 | 0.9613 | - | 53.91 KB |
| AppendWithStringBuilder | 10000 | 213.85 us | 4.248 us | 7.768 us | 212.04 us | 2 | 66.6504 | 66.6504 | 66.6504 | 435.63 KB |
| AppendWithString | 1000 | 759.31 us | 15.032 us | 20.068 us | 756.16 us | 3 | 1755.8594 | 93.7500 | - | 10777.3 KB |
| PrependWithString | 1000 | 761.74 us | 15.045 us | 25.137 us | 761.18 us | 3 | 1755.8594 | 93.7500 | - | 10777.3 KB |
| AppendWithStringBuilder | 100000 | 1,491.00 us | 8.566 us | 7.153 us | 1,493.93 us | 4 | 707.0313 | 652.3438 | 353.5156 | 4316.28 KB |
| PrependWithStringBuilder | 1000 | 3,652.40 us | 57.881 us | 51.310 us | 3,639.86 us | 5 | 19.5313 | 3.9063 | - | 123.07 KB |
| PrependWithString | 10000 | 103,185.42 us | 1,756.825 us | 1,643.335 us | 102,605.36 us | 6 | 316200.0000 | 294200.0000 | 290200.0000 | 1074665.57 KB |
| AppendWithString | 10000 | 103,766.99 us | 2,047.758 us | 2,102.896 us | 103,956.12 us | 6 | 316200.0000 | 294200.0000 | 290200.0000 | 1074665.57 KB |
| PrependWithStringBuilder | 10000 | 443,622.50 us | 8,848.754 us | 9,087.019 us | 443,266.50 us | 7 | - | - | - | 1230.88 KB |
| AppendWithString | 100000 | 31,694,035.38 us | 479,131.423 us | 424,737.527 us | 31,537,399.50 us | 8 | 18852000.0000 | 18809000.0000 | 18805000.0000 | 107431164.26 KB |
| PrependWithString | 100000 | 32,527,484.53 us | 133,803.969 us | 111,732.374 us | 32,527,375.30 us | 9 | 19962000.0000 | 19918000.0000 | 19914000.0000 | 107431463.44 KB |
| PrependWithStringBuilder | 100000 | 58,193,475.60 us | 712,873.020 us | 792,356.472 us | 58,134,526.30 us | 10 | 1000.0000 | - | - | 12305.1 KB |
## Append
| Method | N | Mean | Error | StdDev | Median | Rank | Gen0 | Gen1 | Gen2 | Allocated |
|------------------------- |------- |-----------------:|---------------:|---------------:|-----------------:|-----:|--------------:|--------------:|--------------:|----------------:|
| AppendWithStringBuilder | 1000 | 10.45 us | 0.207 us | 0.548 us | 10.20 us | 1 | 8.7585 | 0.9613 | - | 53.91 KB |
| AppendWithString | 1000 | 759.31 us | 15.032 us | 20.068 us | 756.16 us | 3 | 1755.8594 | 93.7500 | - | 10777.3 KB |
| AppendWithStringBuilder | 10000 | 213.85 us | 4.248 us | 7.768 us | 212.04 us | 2 | 66.6504 | 66.6504 | 66.6504 | 435.63 KB |
| AppendWithString | 10000 | 103,766.99 us | 2,047.758 us | 2,102.896 us | 103,956.12 us | 6 | 316200.0000 | 294200.0000 | 290200.0000 | 1074665.57 KB |
| AppendWithStringBuilder | 100000 | 1,491.00 us | 8.566 us | 7.153 us | 1,493.93 us | 4 | 707.0313 | 652.3438 | 353.5156 | 4316.28 KB |
| AppendWithString | 100000 | 31,694,035.38 us | 479,131.423 us | 424,737.527 us | 31,537,399.50 us | 8 | 18852000.0000 | 18809000.0000 | 18805000.0000 | 107431164.26 KB |
## Prepend
| Method | N | Mean | Error | StdDev | Median | Rank | Gen0 | Gen1 | Gen2 | Allocated |
|------------------------- |------- |-----------------:|---------------:|---------------:|-----------------:|-----:|--------------:|--------------:|--------------:|----------------:|
| PrependWithString | 1000 | 761.74 us | 15.045 us | 25.137 us | 761.18 us | 3 | 1755.8594 | 93.7500 | - | 10777.3 KB |
| PrependWithStringBuilder | 1000 | 3,652.40 us | 57.881 us | 51.310 us | 3,639.86 us | 5 | 19.5313 | 3.9063 | - | 123.07 KB |
| PrependWithString | 10000 | 103,185.42 us | 1,756.825 us | 1,643.335 us | 102,605.36 us | 6 | 316200.0000 | 294200.0000 | 290200.0000 | 1074665.57 KB |
| PrependWithStringBuilder | 10000 | 443,622.50 us | 8,848.754 us | 9,087.019 us | 443,266.50 us | 7 | - | - | - | 1230.88 KB |
| PrependWithString | 100000 | 32,527,484.53 us | 133,803.969 us | 111,732.374 us | 32,527,375.30 us | 9 | 19962000.0000 | 19918000.0000 | 19914000.0000 | 107431463.44 KB |
| PrependWithStringBuilder | 100000 | 58,193,475.60 us | 712,873.020 us | 792,356.472 us | 58,134,526.30 us | 10 | 1000.0000 | - | - | 12305.1 KB |
## Learn More
Please visit [this page](https://learn.microsoft.com/en-us/dotnet/api/system.text.stringbuilder?view=net-7.0#the-string-and-stringbuilder-types).
## LICENSE
MIT