This repo contains useful code used for the performance of .NET
- 🚀 SharpLab
The project requires .NET 6.0.
Tested on:
- Visual Studio Code (1.73.1)
From the terminal/shell/command line tool, use the following commands to build and test.
$ dotnet build
$ dotnet test
1 - String Manipulation
The most basic thing whats we need to know about it:
- String is a reference type
- But String is immutable
// cost to 1000 iteration
string: 124 ms
StringBuilder: 0 ms
Avoid
string test = string.Empty;
test += "concat";
Use
var test = new StringBuilder();
test.Append("append");