dart-lang / dart-lang/native

Dart ffi: first call on iOS device extremely slow

Open
#915 3 comments 1 reaction 0 assignees View on GitHub
package:ffi
Dominant language
Dart
Stars
275
Forks
144
Avg merge
2d 10h
Merged PRs (30d)
47

Description

I am trying to run a GO project ([kagome](https://github.com/ikawaha/kagome)), compiled using CGO to a binary, in Flutter ([here you can find the really bad bindings](https://github.com/CaptainDario/kagome_dart)). This is working very well for Android, MacOS and Windows. But somehow, it takes a very long time (something like 10 min) to run a method (`initTokenizer`) on iPads (most probably iPhones too). This method initialises a global variable. The weird thing is, it does not take any significant amount of time on any other Platform (Windows, MacOS, Android) and also when running the iOS app on a M1 Pro MacBook Pro there is no such problem.
As there is no command line output or anything I am quite clueless what could cause this behaviour. [Here is a](https://drive.google.com/file/d/1mfuVRFlCDg6VIA6DB9rmNJYVadH2aagW/view?usp=share_link) .zip with the dart plugin. Inside the example folder is an example demonstrating the problem. It is setup to run on MacOS and iOS. Pressing the ActionButton invokes the plugin and shows the delay on iOS.

What could cause this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.