Greatly improve performances of \Drupal\tmgmt\Form\JobItemForm::trackChangedSource()

Created on 19 March 2025, 19 days ago

Problem/Motivation

When opening a job item for review, a process tries to determine if sources has been changed or not.
This process is currently poorly optimized, leading to very long loading times for job items with many tags, to the point where it can exceed max execution time and cause a timeout.
It can happen for some nodes with a lot of paragraphs with a lot of fields, for example.

Steps to reproduce

  1. Create a job item with a few hundred tags.
  2. Try to display it.

Proposed resolution

Rework \Drupal\tmgmt\Form\JobItemForm::trackChangedSource() to reduce the amount of calls to \Drupal\tmgmt\Data::flatten().

📌 Task
Status

Active

Version

1.0

Component

Core

Created by

🇫🇷France duaelfr Montpellier, France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @duaelfr
  • 🇫🇷France duaelfr Montpellier, France

    MR with proposed changes open and the related patch for composer.

    In my case (huge job item), the call to the trackChangedSource method has been reduced from 83.88773 seconds to 0.34245.
    The calls to the flatten method from the trackChangedSource method has been reduced from 1966 occurrences to 1.

    I hope tests will pass even if I believe so, given the changes I made.

  • Pipeline finished with Failed
    19 days ago
    Total: 340s
    #452461
Production build 0.71.5 2024