Skip to content

Benchmarks for #117800 (hamarb123) #453

@EgorBot

Description

@EgorBot

Processing dotnet/runtime#117800 (comment) command:

Command

-amd -arm -mono --envvars MONO_ENV_OPTIONS:"--interpreter"

using System;
using System.Linq;
using System.Runtime.InteropServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

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

public class Bench
{
    public unsafe byte* ptr;
    
    [GlobalSetup]
    public unsafe void Setup()
    {
        ptr = (byte*)NativeMemory.AlignedAlloc(4096, 4096);
        new Random(42).NextBytes(MemoryMarshal.CreateSpan(ref *ptr, 4096));
        MemoryMarshal.CreateSpan(ref *ptr, 4096).Replace<byte>(42, 0x42);
    }
    
    [Benchmark]
    public unsafe bool Test()
    {
        return MemoryMarshal.CreateSpan(ref *ptr, 4096).Contains((byte)42);
    }
}

(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