Changes

Jump to: navigation, search

Performance/Fenix/Best Practices

162 bytes added, 22:59, 11 May 2021
no edit summary
As for what to do if the default dispatcher is not a good fit, there's no one-size-fits-all solution. To choose the right threading strategy, it's important to understand your options: learn what each of the Dispatchers are intended for, what mechanisms they use to manage that, and their implications. Here are some additional considerations:
* <code>Dispatchers.IO</code> is often a much better default choice than the default dispatcher because it will usually re-use threads and generally execute tasks immediately. However, if your code does not produce produces many simultaneous tasks – which could generate many new threads – , the IO dispatcher may not be a good fit because it'll re-use existing could create numerous threads.and cause the dispatcher to hit its cap, causing new tasks to wait on earlier tasks
* Avoid creating a dedicated thread or thread pool unless it's strictly necessary: each new thread costs the system resources
If you have questions about what the appropriate threading strategy is, please ask the perf team!
Confirm
975
edits

Navigation menu