You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2025. It is now read-only.
To enable SimdLinq per file, uses `using SimdLinq;`namespace. To enable SimdLinq per project, uses global usings in csproj.
30
+
To enable SimdLinq per file, add the `using SimdLinq;`using directive. To enable SimdLinq across the project, use global usings in the csproj file.
31
31
32
32
```xml
33
33
<ItemGroup>
34
34
<UsingInclude="SimdLinq" />
35
35
</ItemGroup>
36
36
```
37
37
38
-
`SimdLinqExtensions` has methods for concrete types(`int[]`, `Span<double`, etc...) that same name defined in LINQ, so that if a method is used that can effectively use SIMD (such as `Sum` of `int[]`), it will be executed.
38
+
`SimdLinqExtensions` has methods for concrete data types, like `int[]` or `Span<double>`, with the same names as LINQ's methods. If a method is eligible for SIMD optimization (such as the Sum of int[]), the `SimdLinqExtensions` method will be used for improved performance.
39
39
40
-
`Span<T>` has no LINQ methods but SimdLinq has it so you can call `Sum`, `Min` etc in`Span<T>`/`ReadOnlySpan<T>`.
40
+
Unlike base LINQ, SimdLinq supports `Span<T>`, allowing you to call methods such as `Sum`, `Min`, etc. on`Span<T>` or `ReadOnlySpan<T>` collections.
@@ -46,27 +46,27 @@ To enable SimdLinq per file, uses `using SimdLinq;` namespace. To enable SimdLin
46
46
}
47
47
```
48
48
49
-
`MinMax` is a original extension of SimdLinq, that returns tuple of `Min` and `Max`.
49
+
`MinMax` is an original SimdLinq extension, that returns a tuple of `Min` and `Max`.
50
50
51
51
Compatibility
52
52
---
53
-
One of the reasons why LINQ's SIMD support in .NET 7 is incomplete, is compatibility. SimdLinq top priority is SIMD enablement to fastest operation so sacrifices compatibility and some safety features. Please note the following.
53
+
One of the reasons why LINQ's SIMD support in .NET 7 is incomplete, is compatibility. SimdLinq prioritises performance over some safety features and full compatibility with LINQ. Please note the following differences.
54
54
55
55
### Sum/Average
56
56
57
-
LINQ Sum is `checked` but SimdLinq is `unchecked`(SIMD operation is not supported overflow). To reduce the risk of overflow, `Sum` and `Average`supported types are 32-bit or higher(`int`, `long`, `uint`, `ulong`, `double`, `float`).
57
+
LINQ Sum is `checked` but SimdLinq is `unchecked`(SIMD operation is not supported overflow). To reduce the risk of overflow, `Sum` and `Average`only support types that are 32-bit or higher(`int`, `long`, `uint`, `ulong`, `double`, `float`).
58
58
59
59
SimdLinq provides `LongSum` for `int` and `uint`, that returns `long`/`ulong` so avoid overflow.
60
60
61
61
### float/double
62
62
63
-
LINQ Min/Max of float/double checks `NaN` but SimdLinq does not. Also, the order in which Sum is calculated is not sequential. This results in floating-point operations that are different from those in regular LINQ. For example, with LINQ `1.5710588F` but SIMD `1.5710589F`. If compatibility is not important, this is not a problem, but be aware that very small tolerance can occur.
63
+
Unlike LINQ, SimdLinq does not check for NaN in float/double Min/Max calculations. Additionally, the order of calculation for Sum is not sequential, leading to slight differences in floating-point operations compared to regular LINQ. For instance, LINQ returns 1.5710588F, while SimdLinq returns 1.5710589F. If compatibility is not a concern, this difference is not significant, but be aware of potential small tolerance differences.
0 commit comments