Skip to content

Benchmarks for #114792 (kg) #343

@EgorBot

Description

@EgorBot

Processing dotnet/runtime#114792 (comment) command:

Command

-intel -amd

using System.Collections.Generic;
using BenchmarkDotNet.Attributes;

public class Bench
{
    const int Count = 40960;
    private static readonly Dictionary<int, int> ints = new ();

    static Bench () {
        for (int i = 0; i < Count; i++)
            ints[i] = i;
    }

    [Benchmark]
    public bool FindPresent() {
        for (int i = 0; i < Count; i++)
            if (!ints.TryGetValue(i, out _))
                return false;

        return true;
    }

    [Benchmark]
    public bool FindMissing() {
        for (int i = 0; i < Count; i++)
            if (ints.TryGetValue(i + Count, out _))
                return false;

        return true;
    }
}

(EgorBot will reply in this issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions