HI,
Every time the $xml is created it is unique (different values).
This is not what I observe
I just put following line in line 134 of item.php. Just before the $xml = new JParameter... stuff.
print ("File: ".$xmlfile."<br>");
The output generated is here:
http://pastie.org/823008.
Every line there opens the following and obviously identical File:
administrator/components/com_contenttemplater/item_params.xml
You can count the lines and multiply your result with about 0.03 seconds...
What I suggest is:
Create only one instance of JParameter and consequently open the file only one time.
If running in debug mode, Joomla says following:
Time until reneered unpatched: About 6 seconds.
Time until rendered patches: 0,8 seconds.
As already written: The issue has only impact with a lot of templates active. In this situation, we use about 40 templates.
and it actually uses up more php memory
I didn't profile this - but I cannot believe that 1 instance can afford more memory than 200 instances of a class. Perhaps you did something wrong? I copy/paste my code below.
Somewhere out of the model class, best below. Starting at line 485:
class ParamFactory {
static $instance = null;
static function getInstance($ini, $xmlfile) {
if (ParamFactory::$instance == null) {
ParamFactory::$instance = new JParameter( $ini, $xmlfile );
}
$result = ParamFactory::$instance;
return $result;
}
}
Lines 133 and 134:
//$xml = new JParameter( $ini, $xmlfile );
$xml = ParamFactory::getInstance($ini, $xmlfile);