Kwker

Use Kwker from C# and .NET

The Kwker package works with .NET 8 and later on Linux x86-64 and arm64, macOS arm64 and Windows x64. Every call takes spans or arrays of any primitive numeric type, from sbyte to ulong, float and double.

The project

ShellOn your machine.
dotnet new console -o Latency
cd Latency
dotnet add package Kwker

The program

The three slowest requests, without sorting the whole array (Program.cs):

C#Add the Kwker NuGet package, then dotnet run.
using Kwker;

var latencyMs = new double[] { 12.1, 250.4, 8.9, 97.0, 310.2, 15.5, 260.0 };
var (values, positions) = Sorter.TopK<double>(latencyMs, 3, Order.Descending);
for (int i = 0; i < values.Length; i++) Console.WriteLine($"{values[i]} at {positions[i]}");
Output
310.2 at 4
260 at 6
250.4 at 1

Build and run

ShellOn your machine.
dotnet run -c Release

Errors

Invalid arguments throw ArgumentException, ArgumentOutOfRangeException or ArgumentNullException; the arrays are left unchanged.

Next steps