Skip to content

Benchmarks for #122959 (stephentoub) #595

@EgorBot

Description

@EgorBot

Processing dotnet/runtime#122959 (comment) command:

Command

-amd -intel -arm

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Text.RegularExpressions;

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

[MemoryDiagnoser(false)]
public partial class Benchmarks
{
    private Regex _regex;
    private string _haystack;

    [GlobalSetup]
    public async Task Setup()
    {
        using HttpClient client = new();
        _regex = new Regex(await client.GetStringAsync("https://raw.githubusercontent.com/BurntSushi/rebar/refs/heads/master/benchmarks/regexes/wild/date.txt"), RegexOptions.Compiled);
        _haystack = await client.GetStringAsync("https://github.com/BurntSushi/rebar/blob/master/benchmarks/haystacks/rust-src-tools-3b0d4813.txt");
    }

    [Benchmark]
    public int Count() => _regex.Count(_haystack);
}

(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