Skip to content

Commit 140f5a5

Browse files
committed
Added benchmark to readme
1 parent 30cc6a9 commit 140f5a5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The library works best for a small to medium amount of strings (not multiple 100
3131
A more detailed documentation can be found [here](https://linkdotnet.github.io/StringBuilder/).
3232

3333
## Benchmark
34+
3435
The following table gives you a small comparison between the `StringBuilder` which is part of .NET and the `ValueStringBuilder`:
3536

3637
```no-class
@@ -40,4 +41,14 @@ The following table gives you a small comparison between the `StringBuilder` whi
4041
| ValueStringBuilder | 226.7 ns | 2.45 ns | 2.05 ns | 0.1395 | 584 B |
4142
```
4243

44+
Another benchmark shows that this `ValueStringBuilder` uses less memory when it comes to appending `ValueTypes` such as `int`, `double`, ...
45+
46+
```no-class
47+
| Method | Mean | Error | StdDev | Gen 0 | Allocated |
48+
|-------------------- |---------:|---------:|---------:|-------:|----------:|
49+
| DotNetStringBuilder | 17.21 us | 0.622 us | 1.805 us | 1.5259 | 6 KB |
50+
| ValueStringBuilder | 16.24 us | 0.496 us | 1.462 us | 0.3357 | 1 KB |
51+
52+
```
53+
4354
Checkout the [Benchmark](tests/LinkDotNet.StringBuilder.Benchmarks) for more detailed comparison and setup.

0 commit comments

Comments
 (0)