Little tweak to speed up the tab/space method

This commit is contained in:
2018-05-30 13:40:25 +02:00
parent 7f325b1233
commit 640c96ce38
4 changed files with 18 additions and 4 deletions

View File

@ -662,6 +662,13 @@ class Get
*/
public $setTidyWarning = false;
/**
* Tab/spacer bucket (to speed-up the build)
*
* @var array
*/
public $tabSpacerBucket = array();
/**
* Set tab/spacer
*
@ -769,7 +776,14 @@ class Get
*/
public function _t($nr)
{
return str_repeat($this->tabSpacer, (int) $nr);
// check if we already have the string
if (!isset($this->tabSpacerBucket[$nr]))
{
// get the string
$this->tabSpacerBucket[$nr] = str_repeat($this->tabSpacer, (int) $nr);
}
// return stored string
return $this->tabSpacerBucket[$nr];
}
/**