Replies: 2 comments 1 reply
-
|
just a short snippet of what ive used to test but i changed homemodel.dart to use an update function rather than copywith void _addOrUpdateItem(List<ItemBaseModel> list, ItemBaseModel item) {
final index = list.indexWhere((element) => element.id == item.id);
if (index != -1) {
//list[index] = item; //may want to only update if needed
} else {
list.add(item); //add items based on datetime
}
}also chnaged dashboard provider.dart to be a for loop with switch statements and i got an increase of 5-15 avg fps in profile mode. edit: Just a bit of an update to what's above i've gotten some definite performance increase in the ui thread that should help geeneral performance but it seems the issue on my PC is a general flutter issue which made me see the stutters worse than other devices. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for taking a deep dive into the performance that's great to hear. And by all means any improvements are more then welcome. So feel free to create a PR (or multiple), do try to keep individual PR's focused, I would rather have a few PR's then a single big one. While the snippet looks fine. I personally prefer to keep the entire model immutable, but that is just a preference if it hampers performance by all means we should not copy the entire state 😅. I'm just not sure a for loop is more efficient then copying the model with a new list. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey @PartyDonut finally had some time to work on some things on here and I chose to look more into the issue i was having with stutters on my PC.
After a lot of revewing the profiler and understanding some sections of the code i found the issue. Although a simple fix might help it a bit, there is a bigger problem with rebuilds and memory management. I've tested changing some parts of the code and seem to be right. However fully fixing it would need refactors of some sections of code especially the models and providers. I've mostly used the main dashboard page for my testing and can give more details.
I wanted to ask if i give a full proof of concept with the dashboard page to optimize it would it be something that could be considered. I wouldn't want to go on a whole tangent if you don't think so. thanks...
Beta Was this translation helpful? Give feedback.
All reactions