Skip to content

EgorBot for EgorBo in #108818 #119

@EgorBot

Description

@EgorBot

Processing dotnet/runtime#108818 (comment) command:

Command

-intel -gv4 -profiler

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

BenchmarkSwitcher.FromAssembly(typeof(Bencha).Assembly).Run(args);

public class Bencha
{
    static string[] Data = 
        Enumerable.Range(1000, 5000).Select(i => i.ToString()).ToArray();

    [Benchmark]
    public int Bench()
    {
        int sum = 0;
        foreach (var item in Data)
            if (item.StartsWith("111"))
                sum++;
        return sum;
    }

    [Benchmark]
    public int Bench_IgnoreCase()
    {
        int sum = 0;
        foreach (var item in Data)
            if (item.StartsWith("111", StringComparison.OrdinalIgnoreCase))
                sum++;
        return sum;
    }
}

(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