3 ms·
.NET does not need to deal with side effects of threadlocals, do thread pinning or much else - it calls into native code directly like Rust or C++ to its dynami
by neonsunset 3y ago
.NET does not need to deal with side effects of threadlocals, do thread pinning or much else - it calls into native code directly like Rust or C++ to its dynamically linked dependencies. The only cost is pinning objects, if you are passing let's say a pointer to a managed array or string (upfront cost is free but you pay for it later on if you pin for a long time), and notifying GC not to preempt the thread while it's in unmanaged land.
You can get an estimate of FFI overhead difference here: https://web.archive.org/web/20230715041452/https://vancan1ty.com/blog/post/52 https://web.archive.org/web/20230715041452/https://vancan1ty...