-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Processing dotnet/runtime#123319 (comment) command:
Command
-x64 -arm
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Collections.Generic;
BenchmarkSwitcher.FromAssembly(typeof(Bench).Assembly).Run(args);
[MemoryDiagnoser]
public class Bench
{
private List<int> _list = default!;
private int[] _array = default!;
private HashSet<int> _hashSet = default!;
[Params(0, 1, 100)]
public int Count { get; set; }
[GlobalSetup]
public void Setup()
{
_list = Enumerable.Range(0, Count).ToList();
_array = Enumerable.Range(0, Count).ToArray();
_hashSet = Enumerable.Range(0, Count).ToHashSet();
}
[Benchmark]
public bool AnyList() => _list.Any();
[Benchmark]
public bool AnyArray() => _array.Any();
[Benchmark]
public bool AnyHashSet() => _hashSet.Any();
}(EgorBot will reply in this issue)
Metadata
Metadata
Assignees
Labels
No labels