mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-01 22:40:39 +02:00
[ticket/12232] Remove excessive calls to sizeof() in assign_block_vars() method
The size of the template block array is calculated within a foreach loop iterating through the array, which is unnecessary. It only needs to be done once. In a block of 1000 rows, this results in 500,500 calls to sizeof() in this location. With this change, that's reduced to 1000. PHPBB3-12232
This commit is contained in:
@@ -186,11 +186,12 @@ class context
|
|||||||
|
|
||||||
// Add a new iteration to this block with the variable assignments we were given.
|
// Add a new iteration to this block with the variable assignments we were given.
|
||||||
$this->tpldata[$blockname][] = $vararray;
|
$this->tpldata[$blockname][] = $vararray;
|
||||||
|
$s_num_rows = sizeof($this->tpldata[$blockname]);
|
||||||
|
|
||||||
// Set S_NUM_ROWS
|
// Set S_NUM_ROWS
|
||||||
foreach ($this->tpldata[$blockname] as &$mod_block)
|
foreach ($this->tpldata[$blockname] as &$mod_block)
|
||||||
{
|
{
|
||||||
$mod_block['S_NUM_ROWS'] = sizeof($this->tpldata[$blockname]);
|
$mod_block['S_NUM_ROWS'] = $s_num_rows;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user