-
Notifications
You must be signed in to change notification settings - Fork 5
Fix dictionary creation #428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
d9ef164
73c247c
e5d995a
c434887
1d726ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| using System.Collections.Immutable; | ||
|
Check failure on line 1 in tests/Moq.Analyzers.Benchmarks/DiagnosticEditPropertiesBenchmarks.cs
|
||
| using System.Globalization; | ||
|
|
||
| namespace Moq.Analyzers.Benchmarks; | ||
|
|
||
| [InProcess] | ||
| [MemoryDiagnoser] | ||
| public class DiagnosticEditPropertiesBenchmarks | ||
| { | ||
| [Benchmark(Baseline = true)] | ||
| public ImmutableDictionary<string, string?> UsingBuilder() | ||
| { | ||
| var builder = ImmutableDictionary.CreateBuilder<string, string?>(StringComparer.Ordinal); | ||
|
Check failure on line 13 in tests/Moq.Analyzers.Benchmarks/DiagnosticEditPropertiesBenchmarks.cs
|
||
|
rjmurillo marked this conversation as resolved.
Outdated
|
||
| builder.Add("Type", "Insert"); | ||
| builder.Add("Position", 1.ToString(CultureInfo.InvariantCulture)); | ||
|
rjmurillo marked this conversation as resolved.
Outdated
|
||
| return builder.ToImmutable(); | ||
| } | ||
|
rjmurillo marked this conversation as resolved.
Outdated
|
||
|
|
||
| [Benchmark] | ||
| public ImmutableDictionary<string, string?> UsingDictionary() | ||
| { | ||
| return new Dictionary<string, string?>(StringComparer.Ordinal) | ||
| { | ||
| { "Type", "Insert" }, | ||
| { "Position", 1.ToString(CultureInfo.InvariantCulture) }, | ||
| }.ToImmutableDictionary(); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.