Skip to content

This repo contains useful code used for the performance of .NET

Notifications You must be signed in to change notification settings

KellysonRN/dotnet-performance-labs

Repository files navigation

Performance dotNet Labs

Overview

This repo contains useful code used for the performance of .NET

Links useful

Requirements

The project requires .NET 6.0.

Compatible IDEs

Tested on:

  • Visual Studio Code (1.73.1)

Useful commands

From the terminal/shell/command line tool, use the following commands to build and test.

Build the project

$ dotnet build

Run the tests

$ dotnet test

Examples

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");

About

This repo contains useful code used for the performance of .NET

Topics

Resources

Stars

Watchers

Forks

Languages