Ignore:
Timestamp:
12/14/12 14:30:35 (11 years ago)
Author:
douglasz
Message:

Ticket #3236 - Melhorias de performance no codigo do Expresso.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/engine/src/ProcessManager/ProcessManager.php

    r5921 r7655  
    299299                $activities=Array(); 
    300300                $transitions=Array(); 
    301                 for($i=0;$i<count($this->tree[1]['children']);$i++) { 
     301        $tree_count = count($this->tree[1]['children']); 
     302                for($i=0;$i<$tree_count;++$i) { 
    302303                        // Process attributes 
    303304                        $z=$this->tree[1]['children'][$i]; 
     
    306307                        //config values 
    307308                        if ($name=='configs') { 
    308                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     309                $tree_z_count = count($this->tree[$z]['children']); 
     310                                for($j=0;$j<$tree_z_count;++$j) { 
    309311                                        $z2 = $this->tree[$z]['children'][$j]; 
    310312                                        // this is a config $name = $this->tree[$z2]['name']; 
    311313                                        $aux = Array(); 
    312314                                        if($this->tree[$z2]['name']=='config') { 
    313                                                 for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     315                        $tree_z2_count = count($this->tree[$z2]['children']); 
     316                                                for($k=0;$k<$tree_z2_count;++$k) { 
    314317                                                        $z3 = $this->tree[$z2]['children'][$k]; 
    315318                                                        $name = trim($this->tree[$z3]['name']); 
     
    323326                        //activities 
    324327                        elseif($name=='activities') { 
    325                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     328                $tree_z_count = count($this->tree[$z]['children']); 
     329                                for($j=0;$j<$tree_z_count;++$j) { 
    326330                                        $z2 = $this->tree[$z]['children'][$j]; 
    327331                                        // this is an activity $name = $this->tree[$z2]['name']; 
    328332                                        $aux = Array(); 
    329333                                        if($this->tree[$z2]['name']=='activity') { 
    330                                                 for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     334                        $tree_z2_count = count($this->tree[$z2]['children']); 
     335                                                for($k=0;$k<$tree_z2_count;++$k) { 
    331336                                                        $z3 = $this->curre[$z2]['children'][$k]; 
    332337                                                        $name = trim($this->tree[$z3]['name']); 
     
    334339                                                        if($name=='roles') { 
    335340                                                                $roles=Array(); 
    336                                                                 for($l=0;$l<count($this->tree[$z3]['children']);$l++) { 
     341                                $tree_z3_count = count($this->tree[$z3]['children']); 
     342                                                                for($l=0;$l<$tree_z3_count;++$l) { 
    337343                                                                        $z4 = $this->tree[$z3]['children'][$l]; 
    338344                                                                        $name = trim($this->tree[$z4]['name']); 
     
    354360                                                        { 
    355361                                                                $agents=Array(); 
    356                                                                 for($l=0;$l<count($this->tree[$z3]['children']);$l++) 
     362                                $tree_z3_count = count($this->tree[$z3]['children']); 
     363                                                                for($l=0;$l<$tree_z3_count;$l++) 
    357364                                                                { 
    358365                                                                        $z4 = $this->tree[$z3]['children'][$l]; 
     
    362369                                                                        { 
    363370                                                                                $agent = array(); 
    364                                                                                 for($m=0;$m<count($this->tree[$z4]['children']);$m++) 
     371                                        $tree_z4_count = count($this->tree[$z4]['children']); 
     372                                                                                for($m=0;$m<$tree_z4_count;++$m) 
    365373                                                                                { 
    366374                                                                                        $z5 = $this->tree[$z4]['children'][$m]; 
     
    375383                                                                                        elseif ($name=='agent_datas') 
    376384                                                                                        { 
    377                                                                                                 for($n=0;$n<count($this->tree[$z5]['children']);$n++) 
     385                                                $tree_z5_count = count($this->tree[$z5]['children']); 
     386                                                                                                for($n=0;$n<$tree_z5_count;++$n) 
    378387                                                                                                { 
    379388                                                                                                        $z6 = $this->tree[$z5]['children'][$n]; 
     
    383392                                                                                                        if ($name=='agent_data') 
    384393                                                                                                        { 
    385                                                                                                                 for($o=0;$o<count($this->tree[$z6]['children']);$o++) 
     394                                                        $tree_z6_count = count($this->tree[$z6]['children']); 
     395                                                                                                                for($o=0;$o<$tree_z6_count;++$o) 
    386396                                                                                                                { 
    387397                                                                                                                        $z7 = $this->tree[$z6]['children'][$o]; 
     
    419429                                } 
    420430                        } elseif($name=='transitions') { 
    421                                 for($j=0;$j<count($this->tree[$z]['children']);$j++) { 
     431                $tree_z_count = count($this->tree[$z]['children']); 
     432                                for($j=0;$j<$tree_z_count;++$j) { 
    422433                                        $z2 = $this->tree[$z]['children'][$j]; 
    423434                                        // this is an activity $name = $this->tree[$z2]['name']; 
    424435                                        $aux=Array(); 
    425436                                        if($this->tree[$z2]['name']=='transition') { 
    426                                                 for($k=0;$k<count($this->tree[$z2]['children']);$k++) { 
     437                        $tree_z2_count = count($this->tree[$z2]['children']); 
     438                                                for($k=0;$k<$tree_z2_count;++$k) { 
    427439                                                        $z3 = $this->tree[$z2]['children'][$k]; 
    428440                                                        $name = trim($this->tree[$z3]['name']); 
     
    573585                                                        if ($key) 
    574586                                                        { 
    575                                                                 $countfields++; 
     587                                                                ++$countfields; 
    576588                                                                $query .= "$key = ? ,"; 
    577589                                                                $bindvars[] = $value; 
     
    729741                                        if ($key) 
    730742                                        { 
    731                                                 $countfields++; 
     743                                                ++$countfields; 
    732744                                                $query .= "$key = ? ,"; 
    733745                                                $bindvars[] = $value; 
     
    10841096                } else { 
    10851097                        $parts[0]++; 
    1086                         for ($i = 1; $i < count($parts); $i++) { 
     1098            $parts_count = count($parts); 
     1099                        for ($i = 1; $i < $parts_count; ++$i) { 
    10871100                                $parts[$i] = 0; 
    10881101                        } 
Note: See TracChangeset for help on using the changeset viewer.