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

perf(Filters) - increase performance of updating charge filters #2696

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

nudded
Copy link
Contributor

@nudded nudded commented Oct 16, 2024

Description

Based on profiling information we found out that the to_h method on ChargeFilter is called often when updating a charge with a large ( > 100) amount of filters.

A second observation is that the touch method means we're updating all charge filters every time, which has poor performance when you have a lot of those for a given charge.

Changes

  • cache to_h
  • updated_at is used for ordering the filters, but if you have > 100 we've chosen to optimize and not touch all records. This means stuff will change in the UI, but at that amount nobody is really managing them based on order.

@nudded nudded merged commit 34c82c5 into main Oct 16, 2024
6 checks passed
@nudded nudded deleted the perf-charge-filters-update branch October 16, 2024 09:12
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.

2 participants