LinkDotNet.LinqSIMDExtensions 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package LinkDotNet.LinqSIMDExtensions --version 1.1.0                
NuGet\Install-Package LinkDotNet.LinqSIMDExtensions -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LinkDotNet.LinqSIMDExtensions" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LinkDotNet.LinqSIMDExtensions --version 1.1.0                
#r "nuget: LinkDotNet.LinqSIMDExtensions, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LinkDotNet.LinqSIMDExtensions as a Cake Addin
#addin nuget:?package=LinkDotNet.LinqSIMDExtensions&version=1.1.0

// Install LinkDotNet.LinqSIMDExtensions as a Cake Tool
#tool nuget:?package=LinkDotNet.LinqSIMDExtensions&version=1.1.0                

LinqSIMDExtensions

.NET Nuget GitHub tag

LinqSIMDExtensions is a high-performance library that combines the power of SIMD (Single Instruction, Multiple Data) and the elegance of LINQ (Language Integrated Query) syntax. It leverages the generic math features introduced in .NET 7 to provide a wide range of data type support. With LinkDotNet.LinqSIMDExtensions, you can easily process large datasets in parallel, improving the performance of your applications.

It is not recommend to use this library for small datasets as the overhead of the SIMD operations is not worth it.

Features

  • Leverage SIMD operations for fast and parallel processing of data
  • Support for a wide range of data types (thanks to generic math)
  • LINQ syntax so you can almost use it as drop-in replacement
  • Currently supports: Min, Max, Sum, SequenceEqual and Average

Installation

To install the package via NuGet, run the following command :

dotnet add package LinkDotNet.LinqSIMDExtensions

Usage

First you have to import the namespace:

using LinkDotNet.LinqSIMDExtensions;

Then you can use the extension methods:

List<int> numbers = GetNumbers();
var result = numbers.Min();

Benchmark

You can head over to benchmark section to see the setup.

BenchmarkDotNet=v0.13.5, OS=macOS Ventura 13.2.1 (22D68) [Darwin 22.3.0]
Apple M1 Pro, 1 CPU, 10 logical and 10 physical cores
.NET SDK=7.0.202
  [Host]     : .NET 7.0.4 (7.0.423.11508), Arm64 RyuJIT AdvSIMD
  DefaultJob : .NET 7.0.4 (7.0.423.11508), Arm64 RyuJIT AdvSIMD


| Method          |       Mean |   Error |  StdDev | Ratio |
| --------------- | ---------: | ------: | ------: | ----: |
| LinqSUM         |   328.6 ns | 0.77 ns | 0.72 ns |  1.00 |
| LinqSIMDSUM     |   118.9 ns | 0.57 ns | 0.51 ns |  0.36 |
|                 |            |         |         |       |
| LinqAverage     | 1,050.7 ns | 1.04 ns | 0.98 ns |  1.00 |
| LinqSIMDAverage |   178.6 ns | 0.28 ns | 0.25 ns |  0.17 |

Constraints

As we are using SIMD the following constraints apply:

  • The collection type has to be contiguous memory (e.g. List<T>, T[], Span<T>). Types like IEnumerable<T> or IReadOnlyList<T> are not supported.
  • The underlying number has to implement specific interfaces (like IMinMaxValue) to be able to determine the min/max value of the type.
  • Some functions like Average can not return a more specific type than the input. This means that if you have a List<int> and call Average on it, the result will be a int and not an double.
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.0 596 1/8/2024
1.4.1 134 1/7/2024
1.4.0 173 7/23/2023
1.3.0 158 5/7/2023
1.2.2 169 4/12/2023
1.2.1 187 4/10/2023
1.2.0 181 4/4/2023
1.1.0 184 4/4/2023
1.0.0 192 4/1/2023