Low-level fast SIMD algorithms in C#. Cross-platform, trimmable and AOT/NativeAOT compatible.
$ dotnet add package SimdSharpLow-level fast SIMD algorithms in C#. Cross-platform, trimmable and AOT/NativeAOT compatible.
⭐ Please star this project if you like it. ⭐
Example | Example Catalogue | Public API Reference
Simd.Empty();
// Above example code is for demonstration purposes only.
// Short names and repeated constants are only for demonstration.
For more examples see Example Catalogue.
Benchmarks.
| Method | TotalLength | MaxLineLength | Mean | Ratio | Allocated | Alloc Ratio |
|---|---|---|---|---|---|---|
| EnumerateLines_BCL | 32768 | 0 | 101,475.6 ns | 1.00 | - | NA |
| EnumerateLines_SimdSharp | 32768 | 0 | 11,660.0 ns | 0.11 | - | NA |
| EnumerateLines_BCL | 32768 | 8 | 37,298.3 ns | 1.00 | - | NA |
| EnumerateLines_SimdSharp | 32768 | 8 | 4,914.5 ns | 0.13 | - | NA |
| EnumerateLines_BCL | 32768 | 128 | 3,509.0 ns | 1.00 | - | NA |
| EnumerateLines_SimdSharp | 32768 | 128 | 777.4 ns | 0.22 | - | NA |
The following examples are available in ReadMeTest.cs.
Simd.Empty();
// Above example code is for demonstration purposes only.
// Short names and repeated constants are only for demonstration.
[assembly: System.CLSCompliant(false)]
[assembly: System.Reflection.AssemblyMetadata("IsAotCompatible", "True")]
[assembly: System.Reflection.AssemblyMetadata("IsTrimmable", "True")]
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/nietras/SimdSharp/")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("SimdSharp.Benchmarks")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("SimdSharp.ComparisonBenchmarks")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("SimdSharp.Test")]
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("SimdSharp.XyzTest")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v10.0", FrameworkDisplayName=".NET 10.0")]
namespace SimdSharp
{
public static class Simd
{
public static SimdSharp.Simd.MaskSpanLineEnumeratorUTF16 EnumerateLines(System.ReadOnlySpan<char> span) { }
public ref struct MaskSpanLineEnumeratorUTF16 : System.Collections.Generic.IEnumerator<System.ReadOnlySpan<char>>, System.Collections.IEnumerator, System.IDisposable
{
public System.ReadOnlySpan<char> Current { get; }
public SimdSharp.Simd.MaskSpanLineEnumeratorUTF16 GetEnumerator() { }
public bool MoveNext() { }
}
}
}