Goal

Only generate diffs once during a reasonable period of time, and do it in advance, when there is low load, if possible.

Depends on

Plan

  • If an entity revision is created, updated or deleted; then queue the generation of diffs.
  • Purge cache entries that haven't been accessed within storage size, limit time.

Aside

ConfigEntities are not revisioned, so separate is #1821548: Add a "diff" of some kind to the CMI UI.

Original Body - Modified

I recently started using the diff module and find that it's extremely slow on some pages. For example, on my computer a "node/383/revisions/view/385/998" page is taking more than 40 seconds CPU time to generate. I used XDebug and kcachegrind and found that 90% of the time is spent in the diff algorithm.

CommentFileSizeAuthor
diff_cache.patch1.1 KByang_yi_cn

Comments

yang_yi_cn’s picture

BTW, the slow page I mentioned has HTML content for about 1000 lines.

realityloop’s picture

Status: Needs review » Fixed

Added to both 6 and 7 branches

greenreaper’s picture

Status: Fixed » Needs work

This is a nice idea, but it assumes that revisions are immutable, which is not the case. When you edit an existing revision's text, the diff cache is not invalidated, and so subsequent diffs return stale results.

Perhaps there is a way to hook "revision X changing" and reset the diff cache? Though I'm not sure how you'd detect which revisions had cache entries . . . a more sophisticated cache system might be required.

It might also be a good idea to use the CACHE_TEMPORARY parameter for $expire, since these diffs could be of significant size and needn't hang around forever.

realityloop’s picture

Status: Needs work » Postponed (maintainer needs more info)

OK is seems this isn't really a good addition, I never thought it would cause much load anyway, I am going to remove it unless someone cares to update the patch taking into account GreenReapers suggestions

akanik’s picture

I just wanted to make sure my issue is the same as this one....

When revising an article (any node), applied changes show when you go to admin > content and open the node that way, or when you use "list all revisions" (on a node revision page) > "compare" or when you access the node from the "Revisions Pending" block or yourdomain.com/content-summary.

Changes do not show when you attempt to access the node from "revisions" > "list all revisions" > then by clicking on the revision save date.

Please let me know if that was unclear or it this is another issue (either with the module of my competency).

Thanks so much,
allie

mitchell’s picture

Version: 6.x-2.1 » 7.x-3.x-dev
Status: Postponed (maintainer needs more info) » Active
mitchell’s picture

Priority: Normal » Major

#1371916-2: Restructure around the Entity / Field system and a number of other issues in the queue are duplicates, because many of these features require read-accessible-caches, and this issues is about generating caches. Entity Cache would be an ideal backend to use for diff caching, because of the existing Entity API integration, which could also be used for generating views and tokens.

Entity Cache Management can be done with Cachetags and Entity Cache integration, see #1322236: Integration with contrib (entitycache, diff, nodequeue and panels). Cachetags is a robust alternative to using Rules. Another caching strategy to consider with waiting until the first view of a revision to generate its diff, would be to generate valid caches (non-time sensitive) when a revision is created, and also, regenerate caches when revisions are changed. Something along those lines.

mitchell’s picture

Title: add cache to diff generation to improve performance » Diff caching
Project: Diff » Drupal core
Version: 7.x-3.x-dev » 8.x-dev
Component: Code » entity system
Priority: Major » Normal
Status: Active » Postponed
mitchell’s picture

Issue summary: View changes

x

mitchell’s picture

Issue summary: View changes

x

mgifford’s picture

Issue summary: View changes
Status: Postponed » Needs work
Related issues: +#120955: Integrate Diff into Core

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +stale-issue-cleanup

Thank you for sharing your idea for improving Drupal.

We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. 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!

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Since there's been no follow up in 3+ months going to close this one out. If still valid please re-open

Thanks!