Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account code regeneration major performance improvement #117

Merged
merged 4 commits into from
May 29, 2024

Conversation

adamcharnock
Copy link
Owner

@adamcharnock adamcharnock commented May 28, 2024

I think this should drastically speed up the generation of full account codes.

The old:

  • The old code would regenerate the the full account codes for all accounts
  • It would do this upon any modification of the accounts table
  • This made any account modifications something like an O(n**2) operation
  • I clearly thought this was OK back in 2017, when my use case was well under 100 accounts!

The new:

  • Now only children of the modified account are updated
  • And even then only if the account code has been changed (postgres only)
  • Any account codes of NULL or "" will cause all child full account codes to be NULL.
  • I've added a couple more tests

Caveat:

  • I've not ported this optimisation to mysql. @Joshun, if you're still around I'd very much welcome your assistance here (or anyone else for that matter). Lack of this wont block merging though. Update: done, grumbles.

And tagging @PetrDlouhy (#40), FYI.

@adamcharnock adamcharnock force-pushed the performance/update-full-account-codes branch from 9408f9f to 390bd5c Compare May 28, 2024 21:58
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.07%. Comparing base (81b90df) to head (390bd5c).
Report is 6 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #117      +/-   ##
==========================================
+ Coverage   93.01%   93.07%   +0.05%     
==========================================
  Files          59       61       +2     
  Lines        3836     3940     +104     
  Branches      249      256       +7     
==========================================
+ Hits         3568     3667      +99     
- Misses        224      227       +3     
- Partials       44       46       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@adamcharnock adamcharnock force-pushed the performance/update-full-account-codes branch from 390bd5c to 819a30e Compare May 29, 2024 09:17
@adamcharnock adamcharnock merged commit c05ca07 into master May 29, 2024
17 checks passed
@Joshun
Copy link
Contributor

Joshun commented Jun 4, 2024

@adamcharnock thanks for this, I am planning on taking a look at this as soon as I have some spare capacity and will see how difficult it is to implement your improvements in the mysql version.

@adamcharnock
Copy link
Owner Author

Hey @Joshun! I realise now I didn't make this clear in my update – This did in-fact include a MySQL port of the changes. That being said I would certainly appreciate you looking over my work there as I haven't touched MySQL for quite a while.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants