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

Move _select encoding and decoding to threads. #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

noamraph
Copy link

This includes 3 separate changes:

  1. In FlutterContactsPlugin.kt, encode the _select results in the same thread in which fetching is done, instead of on the main thread.
  2. In flutter_contacts.dart, decode on a separate dart isolate.
  3. In example/main.dart, start fetching the contacts after the user presses the button.

There is still non-responsiveness. I think it's shorter.

The change in FlutterContactsPlugin.kt is reasonable - it just follows the implementation of MethodCallHandler, which is pretty small.

The change in flutter_contacts.dart is pretty ugly. I'm really not sure it's worth it.

The change in example/main.dart was useful because it allowed me to start profiling and then press the button.

I send this mostly as reference. If I were the maintainer, I would see how much the change in FlutterContactsPlugin.kt shortens the non-responsive time, and decide if it's worth the (not too big) added complexity. I would not merge the change in flutter_contacts.dart.

I hope this helps,
Noam

@aytunch
Copy link

aytunch commented Nov 30, 2023

Hi, I know this PR is old, but it could help the Android performance a lot for devices which have many contacts.
Will this be worked on any time soon? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants