You should always use the ORM methods as using PHPs count
or looping over the collection is bad practice. The reasoning is most likely off by one errors, which you'll most likely find buried some where in the framework such as varien collection.
*** EDIT *** Link fixed.
Also the reasoning you'll find in the Varien_Data_Collection
class, as I mentioned if you were wanting to iterate over the collection, you're much better off using an iterator like the class does as it's a part of the framework's ORM. most likely the one off is the fact that when getSize
is called the returned value is set with intval
into an integer. As a 0 will = false, on conditions, etc. Take a look at getLastPageNumber
and it will make sense.
As for a much better means of iterations without running out of memory on large collections is:
Mage::getSingleton('core/resource_iterator')->walk($collection->getSelect(), array('productUpdateCallback'));```
Anyhow hopefully this explains it more.