Zend Framework

Zend_Form_Element getTranslator function is MEGA slow (fix included)

Details

  • Type: Performance Improvement Performance Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.1
  • Fix Version/s: 1.10.0
  • Component/s: Zend_Form
  • Labels:
    None

Description

Zend_Form_Element getTranslator function would sometimes get me a page load time of 20seconds (1500 calls when calling onValidate).
I finally found a way to improve performance by 18 seconds:

remove

require_once 'Zend/Form.php';

and it's suddenly only 2 seconds total page load time.

public function getTranslator()
    {
        if ($this->translatorIsDisabled()) {
            return null;
        }

        if (null === $this->_translator) {
//            require_once 'Zend/Form.php'; <---- // FIXED LINE
            return Zend_Form::getDefaultTranslator();
        }
        return $this->_translator;
    }

Ofcource it can be added on top of the class instead.

Activity

Hide
Thomas Weidner added a comment -

Fixed with r18966

Show
Thomas Weidner added a comment - Fixed with r18966

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: