Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using LibraryImport instead of DllImport? #27

Open
rmsimpson opened this issue Mar 22, 2024 · 1 comment
Open

Using LibraryImport instead of DllImport? #27

rmsimpson opened this issue Mar 22, 2024 · 1 comment
Labels
enhancement New feature or request PR Welcome A Pull-Request would be welcome for this issue

Comments

@rmsimpson
Copy link

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

@xoofx xoofx added the PR Welcome A Pull-Request would be welcome for this issue label May 20, 2024
@xoofx
Copy link
Owner

xoofx commented May 20, 2024

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

@xoofx xoofx added the enhancement New feature or request label May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR Welcome A Pull-Request would be welcome for this issue
Projects
None yet
Development

No branches or pull requests

2 participants