-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
How to use concurrency with data passing without blocking the main isolate. #40653
Comments
The work on #37835 (which is under active development) should address this particular use-case. As a stop-gap solution you could try using chunked JSON decoding on the main thread.
I would be curious to hear more about this requirement. If you have so much data that it takes a long time to copy it into the main isolate - then it is unlikely you really are going to display all of it in the UI. Then what is the point of passing it all back into the main isolate? If your UI is going to display only slices of it - then you should be able to just pass over those slices back to the UI isolate. Can you elaborate where the requirement to have the whole gigantic JSON-like data structure in the main isolate comes from? |
I would like to be able to visualize vast amounts of data on a virtual canvas. without having to worry about blocking the UI and without adding unecessary complexity due to limitations by dart. Since I need that canvas to be scalable, all of the data should optimally be available on the first frame. If that is not possible then at least the UI should not skip any frames so that a progress indicator can be displayed. I will try a chunked approach, but I should have mentioned that encoding and decoding json is just a placeholder for many other problems. Working with audio/video/images, calculating technical indicators, any other form of data visualization with big data sets. Yes, there are be workarounds for most of those problems with which one might be able to get a smooth UI, but i should not have to worry about that, just to get a smooth UI. |
@modulovalue #36097 and #37835 has been mainly addressed (on master). Both a |
@mkustermann Thank you, I've tried to solve the issues that I've experienced here with Isolate.exit here: #47508 |
Please take a look at the following example:
Output:
I'd like to do expensive operations outside of the main isolate and receive a lot of data (e.g. large decoded json maps) back.
This example is supposed to show that using an isolate to decode a large json would result in 152 skipped frames for this particular run while doing the same work on the main isolate would only cost 47.
How do I decode large JSON strings where
Related issues: #29480 dart-lang/language#124
The text was updated successfully, but these errors were encountered: