4 ms·
Awesome. Our company is considering moving scientific applications from Python to .NET (C# or F#), mostly for stability reasons and better backwards compatibili
by thatisit 4y ago
Awesome. Our company is considering moving scientific applications from Python to .NET (C# or F#), mostly for stability reasons and better backwards compatibility.
We need to wrap C libraries though. Does anyone have experience with or reliable benchmarks for the C interface?
- meibo 4y agoI can't give you any benchmarks, but in my experience (from wrapping a big C++ game engine in generated C#), modern .NET interop overhead is basically unnoticeable. .NET 7 finally also ships with NativeAOT which compiles your C# to native code that you can expose as a C library.
- littlecranky67 4y agoThe Kestrel HTTP server included in ASP.NET was using libuv (async event loop implemention used also in nodejs) for a while (it is removed now and replaced with the managed `Socket` implementation. Since libuv is native code, they had a lot of PInvokes/DllImport in their glue code. The performance was way ahead of what they had in their IIS implementations, so I think you will be good performance wise.
- Const-me 4y agoIt’s pretty fast. Likely reason for that, MS designed both language and runtime this way since version 1.0. They needed that for their Windows Forms which consumes huge chunk of WinAPI. I benchmarked a while ago when testing this library https://github.com/Const-me/ComLightInterop#performance https://github.com/Const-me/ComLightInterop#performance On the computer I was using at that time (probably Ryzen 5 3600 CPU) the overhead was 15-20 nanoseconds per call.