Modify

Opened 4 years ago

Closed 4 years ago

#3852 closed Bug (Fixed)

_ArrayToString -> speed optimization

Reported by: Zedna Owned by: J-Paul Mesnage
Milestone: 3.3.15.5 Component: Standard UDFs
Version: 3.3.15.4 Severity: None
Keywords: Cc:

Description

StringLen($sDelim_Col) is called for each row
but it should be called only once before For/Next loop.

original part of code:

			For $i = $iStart_Row To $iEnd_Row
				For $j = $iStart_Col To $iEnd_Col
					$sRet &= $aArray[$i][$j] & $sDelim_Col
				Next
				$sRet = StringTrimRight($sRet, StringLen($sDelim_Col)) & $sDelim_Row
			Next
			Return StringTrimRight($sRet, StringLen($sDelim_Row))

optimized part of code:

			$iDelimColLen = StringLen($sDelim_Col)
			For $i = $iStart_Row To $iEnd_Row
				For $j = $iStart_Col To $iEnd_Col
					$sRet &= $aArray[$i][$j] & $sDelim_Col
				Next
				$sRet = StringTrimRight($sRet, $iDelimColLen) & $sDelim_Row
			Next
			Return StringTrimRight($sRet, StringLen($sDelim_Row))

Attachments (0)

Change History (1)

comment:1 by J-Paul Mesnage, 4 years ago

Milestone: 3.3.15.5
Owner: set to J-Paul Mesnage
Resolution: Fixed
Status: newclosed

Fixed by revision [12597] in version: 3.3.15.5

Modify Ticket

Action
as closed The owner will remain J-Paul Mesnage.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.