If like me, you take an unsophisticated approach to batch product updates in Magento, you may have noticed it can be a little slow.
As one of my clients' sites has grown, some batch updates were taking up to 30 minutes to run. This is too long.
If the changes you are making are just to update simple attributes, for example we have a sales ranking attribute, you can use the following code to update the value without incurring the massive overhead of a full product save.
$product->setNumSales(1234);
$product->getResource()->saveAttribute($product, 'num_sales');
The saveAttribute method takes two parameters, the first is the model containing the attribute value, the second the attribute code. To find out the attribute code, look it up in either the db (eav_attribute) or in the admin backend under catalog->attribute.
Using the getResource()-->saveAttribute() call, takes 1/5s, doing a full save(), takes 2-3 seconds. When iterating over a large product base, that is HUGE.
Update 4 Mar 2014 - Please take a look at DannyD's comment below for a more robust approach to mass attribute updates.