Skip to content

Instantly share code, notes, and snippets.

@monadplus
Created March 19, 2020 22:26
Show Gist options
  • Save monadplus/9c618f2a81a567973511e80c4e5d635f to your computer and use it in GitHub Desktop.
Save monadplus/9c618f2a81a567973511e80c4e5d635f to your computer and use it in GitHub Desktop.
GHC FFI overhead
"unsafe" c ffi (doesn't mean what you think) takes 10-15 ns when i measured it on my computer mroe than 5 years ago
[23:03] carter: safe which does some scheduler stuff took an extra 100-200 ns
[23:03] carter: so for c stuff that takes < 1-10 microseconds, unsafe is fine and safe
[23:04] carter: for stuff that runs longer, use safe c calls
[23:05] carter: (reason is: safe calls dont pause / block gc)
[23:07] carter: https://bitbucket.org/carter/who-ya-gonna-call-talk-may-2013-ny-haskell/src/master/ might have some code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment