Skip to content

Benchmarks for #113715 (AaronRobinsonMSFT) #320

Closed
@EgorBot

Description

@EgorBot

Processing dotnet/runtime#113715 (comment) command:

Command

-windows_x64 -arm64

using System;
using System.Runtime.CompilerServices;

using BenchmarkDotNet.Attributes;

public unsafe class Bench
{
    private F _f;
    private byte[] _source;
    private byte[] _dest;
    private delegate* <ref byte, ref byte, nuint, void> _method;

    class F
    {
        ~F() { }
    }

    public Bench()
    {
        _f = new F();
        _source = new byte[10 * 1024];
        _dest = new byte[_source.Length];
        Random random = new Random();
        random.NextBytes(array);

        var method = typeof(Buffer).GetMethod("BulkMoveWithWriteBarrier", BindingFlags.NonPublic | BindingFlags.Static);
        _method = (delegate* <ref byte, ref byte, nuint, void>)method.MethodHandle.GetFunctionPointer();
    }

    [Benchmark]
    public void BenchmarkBulkMoveWithWriteBarrier()
    {
        _method(ref _dest[0], ref _source[0], (nuint)dest.Length);
    }

    [Benchmark]
    public void BenchmarkSuppressFinalize()
    {
        GC.SuppressFinalize(_f);
    }
}

(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