Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dart ffi: first call on iOS device extremely slow #915

Open
CaptainDario opened this issue Jan 18, 2023 · 3 comments
Open

Dart ffi: first call on iOS device extremely slow #915

CaptainDario opened this issue Jan 18, 2023 · 3 comments

Comments

@CaptainDario
Copy link

I am trying to run a GO project (kagome), compiled using CGO to a binary, in Flutter (here you can find the really bad bindings). 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 .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?

@CaptainDario
Copy link
Author

After further investigation, the problem is this package: kagome-dict.
Calling uni.Dict() results in the massive delay.

@Taym95
Copy link

Taym95 commented Jan 27, 2023

can this be closed then?

@CaptainDario
Copy link
Author

CaptainDario commented Jan 28, 2023

@Taym95 I do not know where the problem lies. I assume there is no problem in itself with the mentioned package as the library works on android, linux, macOS and Windows as intended. I would guess the problem is either on the iOS CGO side or the dart ffi side.

The package kagome-dict loads a large binary blob that is embedded in the code using //go:embed, and this function takes up all the time.

@dcharkes dcharkes transferred this issue from dart-archive/ffi Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants