Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class CtorFromCollection<T>
{
private ICollection<T> _collection;
private IDictionary<T, T> _dictionary;
private SortedDictionary<T, T> _sortedDictionary;

[Params(Utils.DefaultCollectionSize)]
public int Size;
Expand All @@ -29,6 +30,9 @@ public class CtorFromCollection<T>
[GlobalSetup(Targets = new[] { nameof(Dictionary), nameof(SortedList), nameof(SortedDictionary), nameof(ConcurrentDictionary), nameof(ImmutableDictionary), nameof(ImmutableSortedDictionary) })]
public void SetupDictionary() => _dictionary = ValuesGenerator.Dictionary<T, T>(Size);

[GlobalSetup(Targets = new[] { nameof(SortedDictionaryDeepCopy) })]
public void SetupSortedDictionary() => _sortedDictionary = new SortedDictionary<T, T>(ValuesGenerator.Dictionary<T, T>(Size));

[Benchmark]
public List<T> List() => new List<T>(_collection);

Expand Down Expand Up @@ -56,6 +60,9 @@ public class CtorFromCollection<T>
[Benchmark]
public SortedDictionary<T, T> SortedDictionary() => new SortedDictionary<T, T>(_dictionary);

[Benchmark]
public SortedDictionary<T, T> SortedDictionaryDeepCopy() => new SortedDictionary<T, T>(_sortedDictionary);

[Benchmark]
public ConcurrentDictionary<T, T> ConcurrentDictionary() => new ConcurrentDictionary<T, T>(_dictionary);

Expand Down