Open nazrinharris opened 7 months ago
This is actually a little tricky, and it is possibly my fault? Basically the Transaction
object itself doesn't know its own category (It's been a while but I'm pretty sure its intentional to allow for multi-categories or split categories in the future), so an additional retrieval needs to be made to find out the transaction's category.
TxnCategories
list.This may however be problematic once the TxnCategories
table have too many entries. And since the only information stored on the table is Transaction
-> Category
, I can't really narrow it down to accounts.
This is probably the best way forward, as I'm already seeing hiccups with 70+ transactions, but that is before the crude optimization, so I think I'll go with option 1 first, if not for anything but to keep things moving.
and it is possibly my fault?
In hindsight, the entire app is written by me, so it is entirely my fault.
I tried removing category retrieval altogether just now, and it seems like the lag is still there. I guess that's just an unavoidable hiccup unless I implement pagination. But then again, this is on a simulator, I'll try it on an actual device and see if there are actually performance hiccups
Tried it on my iPhone 11, with no category retrieval on profile mode. Honestly looking pretty flawless.
Looked into it a bit more while on profile mode, and the retrieval of the category does indeed cause a noticeable difference. Here's the data:
Time for TxnListTile
to complete building (?) with category retrieval: 261 us
Time for TxnListTile
to complete building (?) without category retrieval: 120us
And since this is for each TxnListTile
, as there are a bunch of them depending on the account, this adds up. (I think). So optimizing the category retrieval is pretty key.
But I'm also not sure if its due to the retrieval itself, or because I'm creating a provider for each TxnListTile
, that could also affect something.
Right now, it creates a family provider each time a transaction is rendered, which is quite clearly not optimal. Should update it so that it would retrieve the category list only once.