CareBoo / Blinq

Burst Compatible Linq Implementations

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blinq

Burst Compatible, deferred, stack-allocated LINQ extensions for NativeArray.

Installation

This project can be installed as a UPM package. The easiest way to install it right now is using the OpenUPM.

Currently, support for the Github Package Registry is broken. See this thread here for more information.

Differences with Linq

Delegates

The Burst compiler doesn't support C# delegates. To get around this issue, Blinq requires you to create structs that implement the IFunc interface. The Burst.Delegates project has other useful tools to help you implement the IFunc interface.

/*--- Using Linq ---*/
var selected = myArray.Select(val => val.Item);

/*--- Using Blinq ---*/

// Must define a method that can be used as FunctionPointer
[BurstCompile]
public static int SelectItem(MyVal val) => val.Item;

public static readonly BurstFunc<MyVal, int> SelectItemFunc = BustFunc<MyVal, int>.Compile(SelectItem);

// Now we can finally call ``Select``
var selected = myArray.Select(SelectItemFunc);

About

Burst Compatible Linq Implementations

License:MIT License


Languages

Language:C# 100.0%Language:Shell 0.0%