Method | Mean | Error | StdDev | Median | Gen 0 | Allocated |
------------ |----------:|---------:|----------:|----------:|-------:|----------:|
IntToString | 56.59 ns | 2.616 ns | 7.713 ns | 53.25 ns | 0.0111 | 64 B |
Int | 147.84 ns | 5.335 ns | 15.730 ns | 144.41 ns | 0.0095 | 56 B |
Last active
November 24, 2019 22:19
-
-
Save davidwengier/9a261691ef5a6f2880b088a8e11c15b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BenchmarkDotNet.Attributes; | |
namespace BenchmarkCore | |
{ | |
[MemoryDiagnoser] | |
public class InterpolatedStrings | |
{ | |
[Benchmark] | |
public string IntToString() | |
{ | |
return $"b{1.ToString()}b"; | |
} | |
[Benchmark] | |
public string Int() | |
{ | |
return $"a{1}a"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment