Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Faster – Fast key-value store from Microsoft Research. Parent comment
As low as possible maybe, but there's lots of limiting factors with P/Invoke, such as:
- They are not inlined
- Registers need to be saved pessimistically
- The state at the point of the call is visible to observers outside of code the compiler controls so options for scheduling are constrained
- Objects need to be materialised
- All parameter values need to be available even if they aren't actually used
- Objects passed have to be pinned or given an indirect handle
- The caller has to be in a safepoint so GC can keep running
- The compiler has to juggle things into place for the C ABI, where it may normally lay things out differently
- etc
Going through a P/Invoke call is a whole inconvenient circus compared to an intrinsic.
There are no comments on this comment yet.
As low as possible maybe, but there's lots of limiting factors with P/Invoke, such as:
- They are not inlined
- Registers need to be saved pessimistically
- The state at the point of the call is visible to observers outside of code the compiler controls so options for scheduling are constrained
- Objects need to be materialised
- All parameter values need to be available even if they aren't actually used
- Objects passed have to be pinned or given an indirect handle
- The caller has to be in a safepoint so GC can keep running
- The compiler has to juggle things into place for the C ABI, where it may normally lay things out differently
- etc
Going through a P/Invoke call is a whole inconvenient circus compared to an intrinsic.