Confirmed users
975
edits
(→Avoid blocking on the main thread: Write "good enough" section) |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
This guide will help Fenix developers working on front-end code (i.e. Kotlin/Java) produce code which is as performant as possible – not just on its own, but in terms of its impact on other parts of Firefox. Always keep in mind the side effects your changes may have, from blocking other tasks, to interfering with other user interface elements. | This guide will help Fenix developers working on front-end code (i.e. Kotlin/Java) produce code which is as performant as possible – not just on its own, but in terms of its impact on other parts of Firefox. Always keep in mind the side effects your changes may have, from blocking other tasks, to interfering with other user interface elements. This page is inspired by [https://firefox-source-docs.mozilla.org/performance/bestpractices.html desktop Firefox's front-end perf best practices]. | ||
== Avoid blocking on the main thread == | == Avoid blocking on the main thread == | ||
TODO | Most performance problems are about the algorithm: does this need to happen right here? IO – disk or network – is one of the longest running tasks performed in common Android applications. A typical IO operation is long enough for the user to perceive it. To avoid slowing down the user for too long, don't do IO on the main thread! StrictMode should warn you if you try to do this (though it's only enabled for start up currently). TODO | ||
== Think carefully before optimizations using background threads == | == Think carefully before optimizations using background threads == | ||
Line 25: | Line 25: | ||
== Don't guess, measure. == | == Don't guess, measure. == | ||
TODO: https://firefox-source-docs.mozilla.org/performance/bestpractices.html#dont-guessmeasure | TODO: https://firefox-source-docs.mozilla.org/performance/bestpractices.html#dont-guessmeasure | ||
== Coroutines, posted events, & delaying UI events == | |||
How problematic is this in practice? Worth writing this section? | |||
Also the UI churn associated with it? (less impactful except time to fully drawn?) |