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
| // From a discussion on mastodon https://mastodon.social/@antonz@c.im/112620103070756332 | |
| // This version: | |
| // * simplifies the setup (an inline array is already a Span) | |
| // * uses BinaryPrimitives.ReverseEndianness to batch writing the long to the buffer | |
| // * uses SkipLocalsInit on the ctor to avoid some zero init | |
| // Should be ~ 15% faster than the revised version with Span | |
| // Anyway most of the time is spent in DateTimeOffset.UtcNow and RandomNumberGenerator.Fill | |
| using System.Buffers.Binary; | |
| using System.Diagnostics.CodeAnalysis; | |
| using System.Runtime.CompilerServices; |
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
| // Comment about https://mastodon.social/@brandewinder@hachyderm.io/113064780292323247 | |
| // https://brandewinder.com/2024/09/01/should-i-use-simd-vectors/ | |
| using System.Numerics; | |
| using System.Runtime.InteropServices; | |
| using System.Runtime.Intrinsics; | |
| public class VectorProcessor | |
| { | |
| public static float Take2(float[] left, float[] right) | |
| { |
OlderNewer