The Features UI nowadays has links to show diffs of only specific components. However, the code internally gets / processes / exportifies / slices / dices all components, before outputting only the partial diff.

It's possible to change some functions (add an extra input parameter for the components to process), to overcome this. This patch will drop processing time to roughly 50% - 70% of what it is now, depending on selected feature and component.

Side effect: admin/structure/features/FEATURE/diff/NONEXISTENT_ID now displays the full diff of the feature; after the patch, it displays the 'regular' access-denied message.

Note that the features.drush.inc part of the patch will fail unless you apply #1429014-3: Filter features diff in drush by component first. But you don't need the drush.inc part if you don't have #1429014 anyway. I will reroll if someone wants to include this patch into Features before #1429014, but I don't expect that.

Code details:

  • features_detect_overrides() and features_get_storage() got an extra optional parameter for 'array of components'
  • features_access_override_actions() got an extra optional scalar parameter - since it's a menu callback.
  • features_access_override_actions() and features_detect_overrides() have internal caching that was per module, and is now broken up into module + component (just like features_get_component_states()). I don't see any performance issues resulting from that.
  • So far so good - but I also needed to be able to pass an array of components into features_get_component_states(). I misused the 2nd function argument for that, which is kinda 'meh'. I'd like an opinion before solving the resulting @todo one way or another.

Despite the last thing (one function needs cleanup) I think this should work OK and not backfire on anything.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, features-diff-speedup.patch, failed testing.

roderik’s picture

Status: Needs work » Needs review
FileSize
9.15 KB

Reroll against RC3 with #1429014-7: Filter features diff in drush by component applied. (Because IMHO it makes no sense otherwise. But #1429014 is already being looked at, so I hope I can set this 'needs review' anyway.)

mpotter’s picture

Status: Needs review » Needs work

#1429014: Filter features diff in drush by component has been committed, so let's get a patch posted here for testing.

roderik’s picture

Status: Needs work » Needs review
FileSize
9.63 KB
1006 bytes

Reroll. Tried with 'drush fd'; a very noticeable speedup is still there.

As for my last comment in the original message: I just documented the function and will see if you think the argument which is now 'bool|array' should be split up, renamed or whatever.

roderik’s picture

FileSize
11.32 KB
1.69 KB

Forgot to check test, for calls to optimize.

kenorb’s picture

kenorb’s picture

kenorb’s picture

Re-roll, two rejected sections I've edited manually, so hopefully they were applied right.

mpotter’s picture

This will need some more extensive testing from people, so not going to rush this into 2.10, but thanks for the work on getting the previous patch re-rolled.