Friflo.Vectorization.Generators 0.3.0

Prefix Reserved
dotnet add package Friflo.Vectorization.Generators --version 0.3.0
                    
NuGet\Install-Package Friflo.Vectorization.Generators -Version 0.3.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="Friflo.Vectorization.Generators" Version="0.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Friflo.Vectorization.Generators" Version="0.3.0" />
                    
Directory.Packages.props
<PackageReference Include="Friflo.Vectorization.Generators" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Friflo.Vectorization.Generators --version 0.3.0
                    
#r "nuget: Friflo.Vectorization.Generators, 0.3.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.
#:package Friflo.Vectorization.Generators@0.3.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Friflo.Vectorization.Generators&version=0.3.0
                    
Install as a Cake Addin
#tool nuget:?package=Friflo.Vectorization.Generators&version=0.3.0
                    
Install as a Cake Tool

Friflo.Vectorization.Generators

friflo Vectorization is a C# source generator used to vectorize idiomatic floating point math for x86-64 processors from Intel and AMD using AVX.
It is basically the counter part for auto vectorization used in languages like C/C++ and Rust.
It enables similar optimizations like Unity Burst on the .NET platform.
By applying vectorization the performance of math operations can be improved by magnitudes.

Example
Given a typical code snippet that can be optimized with vectorization.
Languages like C/C++ or Rust can vectorize the method by executing 8 operations in one CPU cycle instead of 1.
C# has no auto vectorization and executes 1 operation per CPU cycle.

static void MovePositionVector(Vector3[] position, Vector3[] velocity, float deltaTime) {
    for (int n = 0; n < position.Length; n++) {
        position[n] += velocity[n] * deltaTime;
    }
}

<br/>

friflo Vectorization applies the same optimization by generation C# code similar to C/C++ or Rust compilers.
To enable this a similar method without a loop has to be annotated with [Vectorize].

[Vectorize]
static void MovePosition([Span] ref Vector3 position, [Span] Vector3 velocity, float deltaTime) {
    position += velocity * deltaTime;
}

The source generator now creates a vectorized method suffixed Vector. It has the same parameters as the example on the top. The generated shadow method can now be called with:

    MovePositionVector(positions, velocities, deltaTime);
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.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
0.3.0 38 5/6/2026
0.2.0 145 4/23/2026
0.1.0 102 4/10/2026