13th October 2015

Make Drupal Features Fly

Peter Berryman
Senior Developer

If, like us, you like to manage your Drupal Features from the command line then you'll be interested in this nifty trick which can make a huge difference to Features performance. When using drush fc to list exportable components, all featurable components are retrieved from the db and loaded into memory. If there are some items you will never feature, like menu links for example, then you can use hook_features_api_alter() to remove them from the listing. On a site with lots of menu links this can have an enormous performance improvement.

/**
* Implements hook_features_api_alter().
*/
function mymodule_features_api_alter(&$components) {
unset($components['menu_links']);
}

When I found I no longer needed to make a round of tea after running drush fc I wept 

One of Pete's colleagues