Thursday 16 November 2006 3:42:29 am
Hi, Thanks for answres! I forgot add that select (multiple) contains 1000 rows - that's why it works so slowly. Don't ask me why it is done this way ;) I resolved my problem writing really small extension:
$FunctionList['fastObjectFetch'] = array( 'name' => 'fastFetchObjects',
'operation_types' => array( 'read' ),
'call_method' => array( 'include_file' =>'extension/myOwn/modules/forest/FunctionCollection.php',
'class' => 'ForetFunctionCollection',
'method' => 'fastFetchObjects' ),
'parameter_type' => 'standard',
'parameters' => array(
array(
'name' => 'node_id',
'type' => 'integer',
'required' => true ),
)
);
and
function fastFetchObjects($node_id)
{
$temp = eZContentObjectTreeNode::subTree( array('AsObject' => false), $node_id);
return array( 'result' => $temp);
}
In template I use
{def $forets = fetch('forets', 'fastFetchObjects', hash('node_id', 174))}
instead of
{def $forets = fetch('content','list', hash(parent_node_id,174, 'sort_by', array('name', true()) ))}
And now it works much, much faster. Could you explain me why?
Proof: Slow case:
Time accumulators:
Mysql Total
Mysql_queries 8.2988 sec 31.8806% 125 0.0664 sec
Looping result 0.6058 sec 2.3272% 93 0.0065 sec
--
Template Total 25.3405 sec 97.3% 3 8.4468 sec
Template load 1.7985 sec 6.9092% 3 0.5995 sec
Template parser: create text elements 0.0455 sec 0.1750% 1 0.0455 sec
Template parser: remove whitespace 0.0123 sec 0.0474% 1 0.0123 sec
Template parser: construct tree 0.2718 sec 1.0442% 1 0.2718 sec
Template load and register function 0.0166 sec 0.0637% 7 0.0024 sec
Template processing 23.5410 sec 90.4345% 3 7.8470 sec
--
Total script time: 26.0310 sec
Fast case:
Time accumulators:
Mysql Total
Mysql_queries 0.3948 sec 8.9410% 124 0.0032 sec
Looping result 0.0719 sec 1.6276% 92 0.0008 sec
--
Template Total 3.7193 sec 84.2% 3 1.2398 sec
Template load 1.7923 sec 40.5901% 3 0.5974 sec
Template parser: create text elements 0.0446 sec 1.0110% 1 0.0446 sec
Template parser: remove whitespace 0.0124 sec 0.2807% 1 0.0124 sec
Template parser: construct tree 0.2732 sec 6.1875% 1 0.2732 sec
Template load and register function 0.0164 sec 0.3709% 7 0.0023 sec
Template processing 1.9260 sec 43.6170% 3 0.6420 sec
--
Total script time: 4.4156 sec
|