Skip to content

Benchmarks for #113575 (EgorBo) #318

@EgorBot

Description

@EgorBot

Processing dotnet/runtime#113575 (comment) command:

Command

-amd -arm -profiler

using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

public class Bench
{
    byte[] _arr1 = new byte[2000];
    byte[] _arr2 = new byte[2000];

    [Benchmark]
    [Arguments(1000)]
    public void CopyN(int elems)
    {
        Span<byte> span1 = _arr1;
        Span<byte> span2 = _arr2;

        for (int i = 0; i < elems; i++)
            span1[i] = span2[i];
    }


    [Benchmark]
    [Arguments(1000)]
    public void ReversedIter(int elems)
    {
        Span<byte> span = _arr1;

        // Reversed iteration
        for (int i = span.Length - 1; i >= 0; i--)
            span[i] = 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