dynamic switching between safe and unsafe FFI
Open
- Dominant language
- Haskell
- Stars
- 35
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
Unsafe FFI is faster but calls longer than about 10µs should be avoided as they can block GC, stopping the world in the threaded runtime.
The `Numeric.MPFR.Raw` module currently reexports `Numeric.MPFR.Raw.Safe` with safe ccall imports, but it could estimate the cost at runtime (using functions of precision as heuristics) and do an unsafe call if it's likely to complete in time. The heuristics must be cheaper than the overheads of a safe FFI call (which is how much?), otherwise it would be better to just do safe FFI calls all the time.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.