Skip to content

Instantly share code, notes, and snippets.

View davidglassborow's full-sized avatar

David Glassborow davidglassborow

View GitHub Profile
@davidglassborow
davidglassborow / BatchSimdDot.cs
Created November 9, 2024 13:55 — forked from xoofx/BatchSimdDot.cs
BatchSimdDot Example
// Comment about https://mastodon.social/@[email protected]/113064780292323247
// https://brandewinder.com/2024/09/01/should-i-use-simd-vectors/
using System.Numerics;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
public class VectorProcessor
{
public static float Take2(float[] left, float[] right)
{
@davidglassborow
davidglassborow / README.md
Created December 3, 2024 12:31 — forked from neon-sunset/README.md
Quick workflow for using F# interactive to build small native console applications
  1. Get .NET SDK with sudo apt install dotnet9 (or dotnet-sdk-9.0), brew install dotnet for macOS
  2. Get FSharpPacker tool with dotnet tool install -g --allow-roll-forward FSharpPacker
  3. Make an F# interactive script file (e.g. copy the phash.fsx below)
  4. Compile it with fspack {your-script.fsx} -f net9.0 -o {destination} --aot
    (in this example: fspack phash.fsx -f net9.0 -o . --aot), note that it will take some time to do so for the first time - .NET needs to fetch IL AOT Compiler from Nuget
  5. Profit! You have compiled an F# script to a native binary
  6. (Optional) If you add fspk.fish, the process is simplified to fspk {my-script}.fsx!

Note 1: if you are not using macOS or FreeBSD, give https://github.com/ieviev/fflat a try which can produce even smaller binaries