-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to turn off generic covariance and contravariance check
- Loading branch information
Showing
20 changed files
with
180 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
5.14.1 | ||
5.15.0 |
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
extern alias from_project; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using BenchmarkDotNet.Attributes; | ||
using from_project::Stashbox.Utils.Data.Immutable; | ||
|
||
namespace Stashbox.Benchmarks; | ||
|
||
[MemoryDiagnoser] | ||
public class TreeBenchmarks | ||
{ | ||
private Type[] keys; | ||
|
||
private ImmutableDictionary<Type, string> imDict; | ||
|
||
private ImmutableTree<Type, string> imTree; | ||
|
||
[Params(10, 100, 1000)] | ||
public int Count; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
imDict = ImmutableDictionary<Type, string>.Empty; | ||
imTree = ImmutableTree<Type, string>.Empty; | ||
keys = typeof(Dictionary<,>).Assembly.GetTypes().Take(Count).ToArray(); | ||
|
||
foreach (var key in keys) | ||
{ | ||
imDict = imDict.Add(key, "value"); | ||
imTree = imTree.AddOrUpdate(key, "value", true); | ||
} | ||
} | ||
|
||
[Benchmark] | ||
public object ImmutableDictionary_Add() | ||
{ | ||
var imDictToAdd = ImmutableDictionary<Type, string>.Empty; | ||
|
||
foreach (var key in keys) | ||
{ | ||
imDictToAdd = imDictToAdd.Add(key, "value"); | ||
} | ||
return imDictToAdd; | ||
} | ||
|
||
[Benchmark] | ||
public object ImmutableTree_AddOrUpdate() | ||
{ | ||
var imTreeToAdd = ImmutableTree<Type, string>.Empty; | ||
|
||
foreach (var key in keys) | ||
{ | ||
imTreeToAdd = imTreeToAdd.AddOrUpdate(key, "value", true); | ||
} | ||
|
||
return imTreeToAdd; | ||
} | ||
|
||
[Benchmark] | ||
public void ImmutableDictionary_TryGetValue() | ||
{ | ||
foreach (var key in keys) | ||
{ | ||
imDict.TryGetValue(key, out _); | ||
} | ||
} | ||
|
||
[Benchmark] | ||
public void ImmutableTree_GetOrDefault() | ||
{ | ||
foreach (var key in keys) | ||
{ | ||
imTree.GetOrDefaultByRef(key); | ||
} | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.