Associate products to all websites more performant

Recently I had to associate all products of a shop to newly created websites in a setup shell script (Associate products to all websites). This could have been implemented like that: <?php /** * Associates products to the newly created websites */ private function _associateProducts() { $aWebsiteIDs = Mage::getModel(‘core/website’) ->getResourceCollection() ->getAllIds(); //remove default website array_shift($aWebsiteIDs); // […]