Skip to content

EgorBot for EgorBo in #108205 #96

Open
@EgorBot

Description

@EgorBot

Processing dotnet/runtime#108205 (comment) command:

Command

-intel -aws_amd -perf

using System.Buffers.Binary;
using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;

public unsafe class Bench
{
    static void* src;
    static void* dst;

    [GlobalSetup]
    public void Setup()
    {
        src = NativeMemory.AlignedAlloc(1024 * 4, 64);
        dst = NativeMemory.AlignedAlloc(1024 * 4, 64);
    }

    [GlobalCleanup]
    public void Cleanup()
    {
        NativeMemory.AlignedFree(src);
        NativeMemory.AlignedFree(dst);
    }

    [Benchmark]
    public void Reverse() => 
        BinaryPrimitives.ReverseEndianness(
            new ReadOnlySpan<int>(src, 1024), 
            new Span<int>(dst, 1024));
}

(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