Project

General

Profile

Refactor #33935

Speed up settings index page

Added by Tomer Brisker 2 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Settings
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Currently, loading the settings page with a few plugins installed leads to ~150k allocations on my machine and around 100ms to render settings/index.html.erb even with all caches "warm" (i.e. the registry is loaded, all locales have been loaded etc.). Let's try to speed it up a bit.

Associated revisions

Revision 64ceeac9 (diff)
Added by Tomer Brisker 2 months ago

Fixes #33935 - Cache setting categories

Every call to `@settings.category` in the index page recalculates all
the category names and labels by iterating over all settings. Since the
categories can't change in runtime, we can calculate it once and store
the list on the settings registry. We can also get the label once per
category instead of repeating it again for every setting. On my
instance, this led to a reduction of about 50k allocations and 20ms.

There are definitly more areas for improvements. Most of the remaining
allocations come from the `grouped_settings` helper, and specifically
inside the `setting.select_values` calculation.

History

#1 Updated by The Foreman Bot 2 months ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8927 added

#2 Updated by The Foreman Bot 2 months ago

  • Fixed in Releases 3.2.0 added

#3 Updated by Tomer Brisker 2 months ago

  • Status changed from Ready For Testing to Closed

#4 Updated by The Foreman Bot about 2 months ago

  • Fixed in Releases 3.1.1 added

#5 Updated by Amit Upadhye about 2 months ago

  • Fixed in Releases 3.1.0 added
  • Fixed in Releases deleted (3.1.1)

Also available in: Atom PDF