Runtime performance degradation for multi-threaded C FFI callback