Avoid loading all terms on the taxonomy overview form

Created on 28 January 2014, almost 11 years ago
Updated 14 February 2023, almost 2 years ago

Problem/Motivation

When a taxonomy vocabulary contains too much terms, it is absolutely impossible to reach some pages like taxonomy overview, even if their content is paginated, because of an huge memory usage. This is caused by the taxonomy_get_tree function for huge taxonomies, but for medium sized taxonomies, this is also caused by the fact that we never clean unused variables.

For information, with a 72000 terms taxonomy (what is not so many for big websites) :

$start = memory_get_usage(TRUE);
$tree = \Drupal::entityManager()->getStorage('taxonomy_term')->loadTree($vid); // 72000 terms
$used_memory = memory_get_usage(TRUE) - $start;
echo $used_memory; // ~ 242 MB

Proposed resolution

Just unset loadTree result when it is not needed anymore. This will not save the life of huge websites but this will definetely help medium ones to stay usables.

Remaining tasks

Post the patch

User interface changes

None

API changes

None

Beta phase evaluation

<!--Uncomment the relevant rows for the issue. -->
πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
TaxonomyΒ  β†’

Last updated 1 day ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @xjm
  • πŸ‡¬πŸ‡§United Kingdom @catch
Created by

πŸ‡«πŸ‡·France duaelfr Montpellier, France

Live updates comments and jobs are added and updated live.
  • needs profiling

    It may affect performance, and thus requires in-depth technical reviews and profiling.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024