Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable SymbolicRegexNode.IsNullableFor fast path to inline #61605

Merged
merged 1 commit into from
Nov 15, 2021

Conversation

stephentoub
Copy link
Member

Method Toolchain Mean Error StdDev Ratio RatioSD Allocated
IsMatch \main\corerun.exe 10.639 ms 0.0453 ms 0.0402 ms 1.00 0.00 -
IsMatch \pr\corerun.exe 9.190 ms 0.1800 ms 0.2143 ms 0.87 0.02 -
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Running;
using System.Linq;
using System.Text.RegularExpressions;

[MemoryDiagnoser]
public partial class Program
{
    public static void Main(string[] args)
    {
        BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
    }

    private Regex _regex = new Regex("[a-q][^u-z]{13}x", RegexOptions.NonBacktracking);
    private string _input = string.Concat(Enumerable.Repeat("abcdefghijklz", 100_000));

    [Benchmark]
    public bool IsMatch() => _regex.IsMatch(_input);
}

@ghost
Copy link

ghost commented Nov 15, 2021

Tagging subscribers to this area: @eerhardt, @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

Issue Details
Method Toolchain Mean Error StdDev Ratio RatioSD Allocated
IsMatch \main\corerun.exe 10.639 ms 0.0453 ms 0.0402 ms 1.00 0.00 -
IsMatch \pr\corerun.exe 9.190 ms 0.1800 ms 0.2143 ms 0.87 0.02 -
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Running;
using System.Linq;
using System.Text.RegularExpressions;

[MemoryDiagnoser]
public partial class Program
{
    public static void Main(string[] args)
    {
        BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
    }

    private Regex _regex = new Regex("[a-q][^u-z]{13}x", RegexOptions.NonBacktracking);
    private string _input = string.Concat(Enumerable.Repeat("abcdefghijklz", 100_000));

    [Benchmark]
    public bool IsMatch() => _regex.IsMatch(_input);
}
Author: stephentoub
Assignees: -
Labels:

area-System.Text.RegularExpressions

Milestone: 7.0.0

Copy link
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code change looks good to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants