Small performance optimization of all for() loops
This commit is contained in:
parent
3c6ef18304
commit
8ba83de00d
|
@ -916,7 +916,7 @@ class tx_dlf_document {
|
|||
''
|
||||
);
|
||||
|
||||
for ($i = 0; $i < $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i++) {
|
||||
for ($i = 0, $j = $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i < $j; $i++) {
|
||||
|
||||
$resArray = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
|
||||
|
||||
|
@ -981,7 +981,7 @@ class tx_dlf_document {
|
|||
''
|
||||
);
|
||||
|
||||
for ($i = 0; $i < $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i++) {
|
||||
for ($i = 0, $j = $GLOBALS['TYPO3_DB']->sql_num_rows($result); $i < $j; $i++) {
|
||||
|
||||
list ($collections[]) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ class tx_dlf_helper {
|
|||
|
||||
$checksum = 0;
|
||||
|
||||
for ($i = 0; $i < strlen($digits); $i++) {
|
||||
for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
|
||||
|
||||
$checksum += (9 - $i) * intval(substr($digits, $i, 1));
|
||||
|
||||
|
@ -398,7 +398,7 @@ class tx_dlf_helper {
|
|||
|
||||
$digits = '';
|
||||
|
||||
for ($i = 0; $i < strlen($urn); $i++) {
|
||||
for ($i = 0, $j = strlen($urn); $i < $j; $i++) {
|
||||
|
||||
$digits .= $concordance[substr($urn, $i, 1)];
|
||||
|
||||
|
@ -406,7 +406,7 @@ class tx_dlf_helper {
|
|||
|
||||
$checksum = 0;
|
||||
|
||||
for ($i = 0; $i < strlen($digits); $i++) {
|
||||
for ($i = 0, $j = strlen($digits); $i < $j; $i++) {
|
||||
|
||||
$checksum += ($i + 1) * intval(substr($digits, $i, 1));
|
||||
|
||||
|
@ -603,7 +603,7 @@ class tx_dlf_helper {
|
|||
|
||||
$_schemas = explode(' ', (string) $_schemaLocation->attributes('http://www.w3.org/2001/XMLSchema-instance')->schemaLocation);
|
||||
|
||||
for ($i = 1; $i <= count($_schemas); $i++) {
|
||||
for ($i = 1, $j = count($_schemas); $i <= $j; $i++) {
|
||||
|
||||
if ($_schemas[$i] == 'http://www.loc.gov/METS/') {
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class tx_dlf_mods implements tx_dlf_format {
|
|||
|
||||
if ($authors) {
|
||||
|
||||
for ($i = 0; $i < count($authors); $i++) {
|
||||
for ($i = 0, $j = count($authors); $i < $j; $i++) {
|
||||
|
||||
$authors[$i]->registerXPathNamespace('mods', 'http://www.loc.gov/mods/v3');
|
||||
|
||||
|
|
|
@ -265,7 +265,7 @@ class tx_dlf_listview extends tx_dlf_plugin {
|
|||
|
||||
$this->loadConfig();
|
||||
|
||||
for ($i = $this->piVars['pointer'] * $this->conf['limit']; $i < ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i++) {
|
||||
for ($i = $this->piVars['pointer'] * $this->conf['limit'], $j = ($this->piVars['pointer'] + 1) * $this->conf['limit']; $i < $j; $i++) {
|
||||
|
||||
if (empty($this->list->elements[$i])) {
|
||||
|
||||
|
|
|
@ -347,7 +347,7 @@ class tx_dlf_oai extends tx_dlf_plugin {
|
|||
|
||||
$complete = FALSE;
|
||||
|
||||
for ($i = $resultSet->metadata['offset']; $i < intval($resultSet->metadata['offset'] + $this->conf['limit']); $i++) {
|
||||
for ($i = $resultSet->metadata['offset'], $j = intval($resultSet->metadata['offset'] + $this->conf['limit']); $i < $j; $i++) {
|
||||
|
||||
$markerArray = array (
|
||||
'###RECORD_DELETED###' => '',
|
||||
|
@ -793,7 +793,7 @@ class tx_dlf_oai extends tx_dlf_plugin {
|
|||
|
||||
$complete = FALSE;
|
||||
|
||||
for ($i = 0; $i < intval($this->conf['limit']); $i++) {
|
||||
for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) {
|
||||
|
||||
$markerArray = array (
|
||||
'###RECORD_DELETED###' => '',
|
||||
|
@ -1181,7 +1181,7 @@ class tx_dlf_oai extends tx_dlf_plugin {
|
|||
|
||||
$complete = FALSE;
|
||||
|
||||
for ($i = 0; $i < intval($this->conf['limit']); $i++) {
|
||||
for ($i = 0, $j = intval($this->conf['limit']); $i < $j; $i++) {
|
||||
|
||||
$markerArray = array (
|
||||
'###RECORD_DELETED###' => '',
|
||||
|
|
Loading…
Reference in New Issue