Answer the question
In order to leave comments, you need to log in
Do I need isolates?
I am making an application that will work with a db. Accept JSON and insert into the database. It is desirable that they utilize several cores. Do I need Isolates or is the built-in async enough?
I would be grateful if you explain in which particular case there will be some use from isolates.
Answer the question
In order to leave comments, you need to log in
Well, the database works through a liba that uses channels - there is already a thread there, I think that's enough asynchronous.
If you use Moor, then everything seems to be ok with isolates.
When isolates are needed:
There is a heavy operation and it blocks the UI. It can be broken into small asynchronous ones and the thread will unload, but it can also slow down. If you need to parse a large JSON, freezes cannot be avoided.
This is where you can give the parsing to the isolate. You can not break it into asynchronous operations, let the thread block itself - since this thread will already be in the new isolate (process).
Briefly:
All calculations that block the stream can be given to isolates.
Every little thing is not worth it, sometimes it's cheaper to do it on Future, but some significant things - yes.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question