Skip to content

Increase element window loading performance#3658

Draft
tvdeyen wants to merge 4 commits intomainfrom
performance/admin-element-index
Draft

Increase element window loading performance#3658
tvdeyen wants to merge 4 commits intomainfrom
performance/admin-element-index

Conversation

@tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Feb 6, 2026

What is this pull request for?

Introduce a new service that preloads element trees efficiently,
eliminating N+1 queries for nested elements at any depth.

Add alchemy_element_preloads hook to RelatableResource concern.
Batch load picture descriptions in Picture

This eliminates N+1 queries when loading picture descriptions in the
element editor. The generic preloading mechanism allows any related
object to define custom preloading by implementing alchemy_element_preloads.

Checklist

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@tvdeyen tvdeyen added this to the 8.1 milestone Feb 6, 2026
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.50%. Comparing base (3fcba47) to head (476cc5d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3658      +/-   ##
==========================================
+ Coverage   97.48%   97.50%   +0.02%     
==========================================
  Files         314      315       +1     
  Lines        8272     8344      +72     
==========================================
+ Hits         8064     8136      +72     
  Misses        208      208              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen tvdeyen force-pushed the performance/admin-element-index branch 4 times, most recently from 4c6f520 to 476cc5d Compare February 9, 2026 09:40
@tvdeyen tvdeyen removed this from the 8.1 milestone Feb 9, 2026
Introduce a new service that preloads element trees efficiently,
eliminating N+1 queries for nested elements at any depth.

Add alchemy_element_preloads hook to RelatableResource concern.
Batch load picture descriptions in Picture

This eliminates N+1 queries when loading picture descriptions in the
element editor. The generic preloading mechanism allows any related
object to define custom preloading by implementing alchemy_element_preloads.
Replace recursive N+1 query pattern with single-query
When all_nested_elements is already loaded (via ElementTreePreloader),
use the preloaded data instead of querying the database. This avoids
N+1 queries when re-initializing TinyMCE editors in the element editor.
When rendering element editors, each picture's thumbnail_url was
triggering an individual query to find the thumb by signature. Now
thumbs are preloaded in batch via the ElementTreePreloader's call
to Picture.preload_for_element_editor.
@tvdeyen tvdeyen force-pushed the performance/admin-element-index branch from 476cc5d to 07eec5a Compare February 9, 2026 15:01
@tvdeyen tvdeyen added the performance Performance improvement label Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant