-1

Mage::getSingleton() always finds for an existing object if not then create that a new object but Mage::getModel() always creates a new object.

1
2

Mage::getSingleton() will first check the same class instance is exists or not in memory. If the instance is created then it will return the same object from memory.

Mage::getModel() will create a new instance of an object each time even such object exists in configuration.

2
  • 6
    I don't think "So Mage::getSingleton() faster then Mage::getModel()". It's only faster for the second call. For the first one it is theoretically slower because there is an extra if involved.
    – Marius
    Apr 4 '16 at 12:43
  • 3
    I don't think the goal of the singleton design pattern is about speed... It is about the principle of having only 1 instance of a certain object throughout the request, implemented for different reasons.
    – 7ochem
    Apr 4 '16 at 12:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.