This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)] | |
| public static unsafe void FastFill<T>(this Span<T> span, T value) | |
| { | |
| int size = Helpers.RuntimeSizeof<T>(); | |
| if (Avx2.IsSupported) | |
| { | |
| if ((size & (size - 1)) == 0 && size < 32) | |
| { | |
| // Is pow of 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [CoreJob(true)] | |
| [RPlotExporter] | |
| [RankColumn] | |
| public class FillBenchmark | |
| { | |
| public readonly object[] RefArray = new object[4096]; | |
| public readonly byte[] ByteArray = new byte[4096]; | |
| public readonly int[] Int32Array = new int[4096]; | |
| [GlobalSetup] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Ran with | |
| internal unsafe class Program | |
| { | |
| public static void Main() | |
| { | |
| BenchmarkRunner.Run<CopySignBenchmark>(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [CoreJob] | |
| public class CopySignDBenchmark | |
| { | |
| public enum SignType | |
| { | |
| Random, | |
| Same, | |
| Different, | |
| Alternating | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [CoreJob] | |
| public class CopySignSingleBenchmark | |
| { | |
| public enum SignType | |
| { | |
| Random, | |
| Same, | |
| Different, | |
| Alternating | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Fills the contents of this span with the given value. | |
| /// </summary> | |
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | |
| public static unsafe void Fill<T>(this Span<T> @this, T value) | |
| { | |
| if (@this.IsEmpty) | |
| { | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x * sqrt(x) * x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public struct Vector2S | |
| { | |
| public Vector2S(float xy) | |
| { | |
| X = xy; | |
| Y = xy; | |
| } | |
| public Vector2S(float x, float y) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Runtime.CompilerServices; | |
| using System.Runtime.Intrinsics; | |
| using System.Runtime.Intrinsics.X86; | |
| using BenchmarkDotNet.Attributes; | |
| using BenchmarkDotNet.Running; | |
| namespace MathSharp.Interactive | |
| { | |
| internal class Program |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Runtime.CompilerServices; | |
| using System.Runtime.Intrinsics; | |
| using System.Runtime.Intrinsics.X86; | |
| namespace MathExample | |
| { | |
| public enum Precision | |
| { | |
| Exact, |
OlderNewer