[GH-ISSUE #6959] [Bug]: Balance calculation for rule application making schedule preview transactions slow #52048

Open
opened 2026-04-30 20:12:20 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @matt-fidd on GitHub (Feb 13, 2026).
Original GitHub issue: https://github.com/actualbudget/actual/issues/6959

What happened?

I found that while debugging an extremely large budget file, preview transactions were taking a long time to load (~5s after the transactions loaded). Looks like this is because rules are run on each transaction (side note, our current rule application method is poorly optimised for running rules on large transaction sets), and for each transaction, the account balance is calculated for use in rule formulae or rule action templating.

We should really find a way around this, balance calculation is expensive, especially in large accounts (these were all >3000 transactions), and if it's removed from the rules application, the TTL comes down from ~5s to >100ms.

Not sure how to label this, so it's a bug until someone disagrees :)

How can we reproduce the issue?

x

Where are you hosting Actual?

None

What browsers are you seeing the problem on?

No response

Operating System

None

Originally created by @matt-fidd on GitHub (Feb 13, 2026). Original GitHub issue: https://github.com/actualbudget/actual/issues/6959 ### What happened? I found that while debugging an extremely large budget file, preview transactions were taking a long time to load (~5s after the transactions loaded). Looks like this is because rules are run on each transaction (side note, our current rule application method is poorly optimised for running rules on large transaction sets), and for each transaction, the account balance is calculated for use in rule formulae or rule action templating. We should really find a way around this, balance calculation is expensive, especially in large accounts (these were all >3000 transactions), and if it's removed from the rules application, the TTL comes down from ~5s to >100ms. Not sure how to label this, so it's a bug until someone disagrees :) ### How can we reproduce the issue? x ### Where are you hosting Actual? None ### What browsers are you seeing the problem on? _No response_ ### Operating System None
GiteaMirror added the tech debtbug labels 2026-04-30 20:12:23 -05:00
Author
Owner

@totallynotjon commented on GitHub (Feb 13, 2026):

Out of curiosity, is there an example large file that can be used to reproduce this? Seems like a fun one

<!-- gh-comment-id:3894810881 --> @totallynotjon commented on GitHub (Feb 13, 2026): Out of curiosity, is there an example large file that can be used to reproduce this? Seems like a fun one
Author
Owner

@matt-fidd commented on GitHub (Feb 13, 2026):

This one should work. The problem is completely gone if you just skip balance calculations, although that's obviously not what we'd want. Maybe it could be smarter about it and only calculate the balance if the rules for that transaction required it to?

Caching account balance is no good, because it can change from one transaction to the next (whether preview transactions balance calculation respect previous preview balance changes is probably another topic...)

largeBudget.zip

<!-- gh-comment-id:3894881960 --> @matt-fidd commented on GitHub (Feb 13, 2026): This one should work. The problem is completely gone if you just skip balance calculations, although that's obviously not what we'd want. Maybe it could be smarter about it and only calculate the balance if the rules for that transaction required it to? Caching account balance is no good, because it can change from one transaction to the next (whether preview transactions balance calculation respect previous preview balance changes is probably another topic...) [largeBudget.zip](https://github.com/user-attachments/files/25280774/largeBudget.zip)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#52048