Skip to content

dynamic switching between safe and unsafe FFI #29

Description

@claudeha

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions