Blake3.NET icon indicating copy to clipboard operation
Blake3.NET copied to clipboard

Using LibraryImport instead of DllImport?

Open rmsimpson opened this issue 1 year ago • 1 comments

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

rmsimpson avatar Mar 22 '24 21:03 rmsimpson

Yep, LibraryImport is much better, especially for string marshalling, PR welcome!

xoofx avatar May 20 '24 15:05 xoofx