diff --git a/Directory.Packages.props b/Directory.Packages.props index 20962c6c74d..514e430eaab 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -74,6 +74,7 @@ + diff --git a/Robust.Benchmarks/NumericsHelpers/AddBenchmark.cs b/Robust.Benchmarks/NumericsHelpers/AddBenchmark.cs index 100ad649423..6be5f3de6aa 100644 --- a/Robust.Benchmarks/NumericsHelpers/AddBenchmark.cs +++ b/Robust.Benchmarks/NumericsHelpers/AddBenchmark.cs @@ -1,17 +1,19 @@ -using BenchmarkDotNet.Attributes; +using System.Numerics.Tensors; +using BenchmarkDotNet.Attributes; +using BenchmarkDotNet.Configs; using Robust.Shared.Analyzers; namespace Robust.Benchmarks.NumericsHelpers; [Virtual] +[GroupBenchmarksBy(BenchmarkLogicalGroupRule.ByMethod)] +[MemoryDiagnoser] +[DisassemblyDiagnoser] public class AddBenchmark { - [Params(32, 128)] + [Params(32, 128, 256, 512, 1024, 2048, 4096, 8192, 16384)] public int N { get; set; } - [Params(1,2)] - public int T { get; set; } - private float[] _inputA = default!; private float[] _inputB = default!; private float[] _output = default!; @@ -25,8 +27,14 @@ public void Setup() } [Benchmark] - public void Bench() + public void BenchNumericsHelpers() { Shared.Maths.NumericsHelpers.Add(_inputA, _inputB, _output); } + + [Benchmark] + public void BenchTensor() + { + TensorPrimitives.Add(_inputA, _inputB, _output); + } } diff --git a/Robust.Benchmarks/Robust.Benchmarks.csproj b/Robust.Benchmarks/Robust.Benchmarks.csproj index 7e114649cce..f47c475bc93 100644 --- a/Robust.Benchmarks/Robust.Benchmarks.csproj +++ b/Robust.Benchmarks/Robust.Benchmarks.csproj @@ -22,6 +22,8 @@ + + diff --git a/Robust.Shared/ContentPack/Sandbox.yml b/Robust.Shared/ContentPack/Sandbox.yml index c969a9d03c4..db9eaffd4ec 100644 --- a/Robust.Shared/ContentPack/Sandbox.yml +++ b/Robust.Shared/ContentPack/Sandbox.yml @@ -641,6 +641,8 @@ Types: Vector2: { All: True } Vector3: { All: True } Vector4: { All: True } + System.Numerics.Tensors: + TensorPrimitives: { All: True } System.Reflection: Assembly: Methods: diff --git a/Robust.Shared/Robust.Shared.csproj b/Robust.Shared/Robust.Shared.csproj index 424cc81c669..cdd7bf9746e 100644 --- a/Robust.Shared/Robust.Shared.csproj +++ b/Robust.Shared/Robust.Shared.csproj @@ -13,6 +13,7 @@ +