- ๐บ๐ธUnited States smustgrave
Thank you for creating this issue to improve Drupal.
We are working to decide if this task is still relevant to a currently supported version of Drupal. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or is no longer relevant. Your thoughts on this will allow a decision to be made.
Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
- ๐ช๐ธSpain psf_ Huelva
In my use case, I have a computed field whose calculation is relatively expensiveโit takes about 11 seconds every time it is calculated. This happens regardless of whether the computed field is actually used or accessed in the request. As a result, the whole request is delayed by 11 seconds, even when the computed field will not be read at all.
Most computed fields are used only in specific contexts (for example, when rendering a view or exporting structured data), and not in every code path that loads the entity. However, the current implementation calculates all computed fields for every entity load, causing substantial and unnecessary performance degradation.
Some key points to consider:
- As more computed fields are defined throughout a site, performance degrades incrementally, often in hidden or hard-to-detect ways.
- The impact is often only noticed when there are enough computed fields, or when one of them is slow to compute.
- Delaying (lazily evaluating) the calculation until field usage would avoid unnecessary work and make the impact of computed fields more predictable and manageable.
- This would bring Drupal in line with the principle of not doing expensive work unless and until it is explicitly needed by code.
To sum up:
Computed fields should not be evaluated unless their value is actually needed.
Implementing lazy evaluation would avoid hidden and potentially significant slowdowns in any site using computed fields. - ๐ช๐ธSpain psf_ Huelva
My point of view is that if a site has 100 modules, and 25 of them add a computed field that takes 20ms to calculate, the site will have a response time that's 500ms slower just because of this.