Skip to content

Benchmarks for #124320 (Copilot) #612

@EgorBot

Description

@EgorBot

Processing dotnet/runtime#124320 (comment) command:

Original command:

-x64 -arm

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Globalization;

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

[MemoryDiagnoser]
public class Bench
{
    private char _hebrewChar;
    private char _arabicChar;
    private char _chineseChar;
    private char _cyrillicChar;

    [GlobalSetup]
    public void Setup()
    {
        _hebrewChar = '\x05D0';   // Hebrew letter Aleph (from original issue)
        _arabicChar = '\x0623';   // Arabic letter Alef with Hamza above
        _chineseChar = '\u4E00';  // CJK Unified Ideograph
        _cyrillicChar = '\u0410'; // Cyrillic Capital Letter A
    }

    [Benchmark]
    public UnicodeCategory GetUnicodeCategory_Hebrew()
    {
        return char.GetUnicodeCategory(_hebrewChar);
    }

    [Benchmark]
    public UnicodeCategory GetUnicodeCategory_Arabic()
    {
        return char.GetUnicodeCategory(_arabicChar);
    }

    [Benchmark]
    public UnicodeCategory GetUnicodeCategory_Chinese()
    {
        return char.GetUnicodeCategory(_chineseChar);
    }

    [Benchmark]
    public UnicodeCategory GetUnicodeCategory_Cyrillic()
    {
        return char.GetUnicodeCategory(_cyrillicChar);
    }
}

This will compare the PR against the base branch to confirm the ~1-3ns improvement for non-ASCII characters.

(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