Blake3.NET
Blake3.NET copied to clipboard
Using LibraryImport instead of DllImport?
I ran a few benchmarks on my system, found the summaries interesting. I rebuilt the code with .NET Core 9.0-Preview 2, then ran these benchmarks:
- Default with no changes
- Removing the SuppressGCTransition attribute
- Switching to LibraryImport
- Setting DisableRuntimeMarshalling attribute
Short version: LibraryImport won handily on the 1,000,000 byte test
Summary default.txt Summary with GC.txt Summary with LibraryImport.txt Summary with LibraryImport_DisableRuntimeMarshalling.txt
Yep, LibraryImport is much better, especially for string marshalling, PR welcome!