Skip to content
This repository was archived by the owner on Feb 23, 2026. It is now read-only.
This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Benchmarks for #113857 (davidwrighton) #326

Open

Description

@EgorBot

Processing dotnet/runtime#113857 (comment) command:

Command

-amd -arm -windows_intel

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Numerics;

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

public class Tests
{
    private object _lockObj = new object();
    private int _field = 0;

    [Benchmark(Baseline = true)]
    public void Lock_OnLockObj()
    {
        _field++;
        lock(_lockObj)
        {
            _field++;
        }
    }

    [Benchmark]
    public void LockOnThis_ThisKnownToBeNonNull()
    {
        _field++;
        lock(this)
        {
            _field++;
        }
    }

    [Benchmark]
    public void LockOnThis()
    {
        lock(this)
        {
            _field++;
        }
    }
}

(EgorBot will reply in this issue)

Activity

  1. EgorBot commented on Mar 24, 2025

    @EgorBot
    OwnerAuthor

    ❌ Failed on AzureGenoa: Job failed, see logs.

    cc @davidwrighton (logs). EgorBot manual: link.

  2. EgorBot commented on Mar 24, 2025

    @EgorBot
    OwnerAuthor

    ❌ Failed on AzureCobalt100: Job failed, see logs.

    cc @davidwrighton (logs). EgorBot manual: link.

  3. EgorBo commented on Mar 24, 2025

    @EgorBo

    @davidwrighton it's a random build error that I don't understand why it happens sometimes:

    EXEC : error : Unable to load shared library 'jitinterface_x64' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: [/home/egorbot/runtime/src/coreclr/crossgen-corelib.proj]
      /home/egorbot/runtime/artifacts/bin/coreclr/linux.x64.Release/x64/crossgen2/jitinterface_x64.so: cannot open shared object file: No such file or directory
      /home/egorbot/runtime/artifacts/bin/coreclr/linux.x64.Release/x64/crossgen2/libjitinterface_x64.so: cannot open shared object file: No such file or directory
      /home/egorbot/runtime/artifacts/bin/coreclr/linux.x64.Release/x64/crossgen2/jitinterface_x64: cannot open shared object file: No such file or directory
      /home/egorbot/runtime/artifacts/bin/coreclr/linux.x64.Release/x64/crossgen2/libjitinterface_x64: cannot open shared object file: No such file or directory
    

    let me debug it again.. must be some LIBC mismatch

  4. EgorBo commented on Mar 24, 2025

    @EgorBo

    Windows job should finish just fine

  5. EgorBo commented on Mar 24, 2025

    @EgorBo
  6. EgorBot commented on Mar 24, 2025

    @EgorBot
    OwnerAuthor

    Benchmark results on windows_azure_cascadelake

    BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2314) (Hyper-V)
    azure_cascadelake
      Job-YOAKDR : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
      Job-VPJOMB : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
    
    Method Job Toolchain Mean Error Ratio
    Lock_OnLockObj Job-YOAKDR \core_root_base\corerun.exe 19.27 ns 0.020 ns 1.00
    LockOnThis_ThisKnownToBeNonNull Job-YOAKDR \core_root_base\corerun.exe 19.58 ns 0.016 ns 1.02
    LockOnThis Job-YOAKDR \core_root_base\corerun.exe 19.37 ns 0.032 ns 1.01
    Lock_OnLockObj Job-VPJOMB \core_root_diff\corerun.exe 19.25 ns 0.017 ns 1.00
    LockOnThis_ThisKnownToBeNonNull Job-VPJOMB \core_root_diff\corerun.exe 19.60 ns 0.045 ns 1.02
    LockOnThis Job-VPJOMB \core_root_diff\corerun.exe 19.33 ns 0.030 ns 1.00

    BDN_Artifacts.zip

    cc @davidwrighton (agent_logs.txt). EgorBot manual: link.

  7. EgorBo commented on Mar 24, 2025

    @EgorBo

    Ok, seems that I've fixed the problem with a workaround

  8. EgorBo commented on Mar 24, 2025

    @EgorBo

    @EgorBot -amd -arm -pr 113857

    using BenchmarkDotNet.Attributes;
    using BenchmarkDotNet.Running;
    using System.Numerics;
    
    BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
    
    public class Tests
    {
        private object _lockObj = new object();
        private int _field = 0;
    
        [Benchmark(Baseline = true)]
        public void Lock_OnLockObj()
        {
            _field++;
            lock(_lockObj)
            {
                _field++;
            }
        }
    
        [Benchmark]
        public void LockOnThis_ThisKnownToBeNonNull()
        {
            _field++;
            lock(this)
            {
                _field++;
            }
        }
    
        [Benchmark]
        public void LockOnThis()
        {
            lock(this)
            {
                _field++;
            }
        }
    }
  9. davidwrighton commented on Mar 24, 2025

    @davidwrighton

    @EgorBo thank you. I was really hoping not to burden you with more work.

  10. EgorBot commented on Mar 24, 2025

    @EgorBot
    OwnerAuthor

    Benchmark results on linux_azure_cobalt100

    BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
    azure_cobalt100
      Job-QKYKGR : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
      Job-VDGVUF : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
    
    Method Toolchain Mean Error Ratio
    Lock_OnLockObj Main 20.05 ns 0.002 ns 1.00
    LockOnThis_ThisKnownToBeNonNull Main 20.18 ns 0.002 ns 1.01
    LockOnThis Main 20.41 ns 0.009 ns 1.02
    Lock_OnLockObj PR 19.91 ns 0.004 ns 0.99
    LockOnThis_ThisKnownToBeNonNull PR 20.38 ns 0.003 ns 1.02
    LockOnThis PR 20.45 ns 0.006 ns 1.02

    BDN_Artifacts.zip

    cc @EgorBo (agent_logs.txt). EgorBot manual: link.

  11. EgorBot commented on Mar 24, 2025

    @EgorBot
    OwnerAuthor

    Benchmark results on linux_azure_genoa

    BenchmarkDotNet v0.14.0, Ubuntu 24.04.2 LTS (Noble Numbat)
    AMD EPYC 9V74, 1 CPU, 16 logical and 8 physical cores
      Job-YNEKDB : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
      Job-WYCSJD : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
    
    Method Toolchain Mean Error Ratio
    Lock_OnLockObj Main 8.494 ns 0.0092 ns 1.00
    LockOnThis_ThisKnownToBeNonNull Main 8.159 ns 0.0073 ns 0.96
    LockOnThis Main 8.173 ns 0.0012 ns 0.96
    Lock_OnLockObj PR 8.283 ns 0.0183 ns 0.98
    LockOnThis_ThisKnownToBeNonNull PR 8.177 ns 0.0052 ns 0.96
    LockOnThis PR 8.174 ns 0.0008 ns 0.96

    BDN_Artifacts.zip

    cc @EgorBo (agent_logs.txt). EgorBot manual: link.

  12. EgorBo commented on Mar 24, 2025

    @EgorBo

    @EgorBo thank you. I was really hoping not to burden you with more work.

    No problem! I wanted to fix this issue for quite some time

  13. am11 commented on Mar 24, 2025

    @am11

    Do we want to run comparisons with https://github.com/dotnet/runtime/commits/ac13edc2df258639b106edfe88147520d0ff3247, one commit in main before dotnet/runtime#113242 was merged?

    or only dotnet/runtime#113857 vs. main?

  14. EgorBo commented on Mar 25, 2025

    @EgorBo

    Do we want to run comparisons with https://github.com/dotnet/runtime/commits/ac13edc2df258639b106edfe88147520d0ff3247, one commit in main before dotnet/runtime#113242 was merged?

    or only dotnet/runtime#113857 vs. main?

    The bot compares PR vs current tip of Main

  15. am11 commented on Mar 25, 2025

    @am11

    Yup, but I was asking if David wants to compare the previous PR because this one is just a follow up and previous PR had few commits before the merge which weren't benchmarked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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