Performance issues with multi-currency setup #1530
Labels
💻 Self Hosting
Issues pertaining to self-hosted versions of Maybe
⚡ Performance
Performance issues to address
I have been using Maybe with a non-trivial amount of data (10 000 account_entries, 40 accounts, 5 different currencies) since the beginning and have always observed performance issues. I have finally found the time to replicate my production database in my local environment and do some poking around. Thought I'd create this issue to gather my findings.
Note that all the timings below are are measured on my beefy MacBook Pro. My actual production instance is running on a Synology NAS where all the loading times are about 4 times worse 😄
Rendering the
/transactions
pageAbout 50% of the time here is spent rendering the Income and Expense statistics at the top of the page, caused by the currency conversion in
Money.exchange_to
(this linemaybe/lib/money.rb
Line 49 in b2a56ae
Some ideas to improve this:
converted_amount
in the account_entries tableJust to get an idea of big of an impact this has; here is a before/after after I have replaced line 49 with
exchange_rate = 1
(= skipping the exchange rate query)Rendering the dashboard (
/
) pageWhile this page would also benefit from the optimization mentioned above, there's another fun issue I've found - removing the entire
<% if self_hosted? %>
check from the top of thedashboard.html.erb
view (maybe/app/views/pages/dashboard.html.erb
Line 2 in b2a56ae
Seems like checking the Synth state blocks rendering (?)
Sidebar
All of the individual accounts in the sidebar are still rendered even when the account type is collapsed (
maybe/app/views/accounts/_account_list.html.erb
Line 31 in b2a56ae
Wrap up
That's it for today, I hope you find this useful @zachgoll! In this first pass I tried to focus on the biggest offenders/low hanging fruit. Will be more than happy to dig around again in a few weeks.
The text was updated successfully, but these errors were encountered: