mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
31 lines
688 B
C#
31 lines
688 B
C#
using BenchmarkDotNet.Attributes;
|
|
using Robust.Shared.Analyzers;
|
|
|
|
namespace Robust.Benchmarks.NumericsHelpers
|
|
{
|
|
[Virtual]
|
|
public class AddBenchmark
|
|
{
|
|
[Params(32, 128)]
|
|
public int N { get; set; }
|
|
|
|
private float[] _inputA = default!;
|
|
private float[] _inputB = default!;
|
|
private float[] _output = default!;
|
|
|
|
[GlobalSetup]
|
|
public void Setup()
|
|
{
|
|
_inputA = new float[N];
|
|
_inputB = new float[N];
|
|
_output = new float[N];
|
|
}
|
|
|
|
[Benchmark]
|
|
public void Bench()
|
|
{
|
|
Shared.Maths.NumericsHelpers.Add(_inputA, _inputB, _output);
|
|
}
|
|
}
|
|
}
|