You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that this will prevent you from returning `stringBuilder` or assigning it to an `out` parameter.
30
35
31
36
## What does it solve?
32
37
The dotnet version of the `StringBuilder` is an all-purpose version that normally fits a wide variety of needs.
33
38
But sometimes, low allocation is key. Therefore I created the `ValueStringBuilder`. It is not a class but a `ref struct` that tries to allocate as little as possible.
34
39
If you want to know how the `ValueStringBuilder` works and why it uses allocations and is even faster, check out [this](https://steven-giesel.com/blogPost/4cada9a7-c462-4133-ad7f-e8b671987896) blog post.
35
40
The blog goes into a bit more in detail about how it works with a simplistic version of the `ValueStringBuilder`.
36
41
37
-
## What it doesn't solve!
38
-
The library is not meant as a general replacement for the `StringBuilder`shipped with the .net framework itself. You can head over to the documentation and read about the ["Known limitations"](https://linkdotnet.github.io/StringBuilder/articles/known_limitations.html).
39
-
The library works best for a small to medium amount of strings (not multiple 100'000 characters, even though it can be still faster and uses fewer allocations). At any time, you can convert the `ValueStringBuilder` to a "normal" `StringBuilder` and vice versa.
42
+
## What doesn't it solve?
43
+
The library is not meant as a general replacement for the `StringBuilder`built into .NET. You can head over to the documentation and read about the ["Known limitations"](https://linkdotnet.github.io/StringBuilder/articles/known_limitations.html).
44
+
The library works best for a small to medium length strings (not hundreds of thousands of characters, even though it can be still faster and performs fewer allocations). At any time, you can convert the `ValueStringBuilder` to a "normal" `StringBuilder` and vice versa.
40
45
41
46
The normal use case is to concatenate strings in a hot path where the goal is to put as minimal pressure on the GC as possible.
42
47
43
48
## Documentation
44
-
More detailed documentation can be found [here](https://linkdotnet.github.io/StringBuilder/). It is really important to understand how the `ValueStringBuilder` works so that you did not run into weird situations where performance/allocations can even rise.
49
+
More detailed documentation can be found [here](https://linkdotnet.github.io/StringBuilder). It is really important to understand how the `ValueStringBuilder` works so that you did not run into weird situations where performance/allocations can even rise.
45
50
46
51
## Benchmark
47
52
48
-
The following table gives you a small comparison between the `StringBuilder`which is part of .NET and the`ValueStringBuilder`:
53
+
The following table compares the built-in `StringBuilder` and this library's`ValueStringBuilder`:
0 commit comments