Modify ↓
Opened 11 years ago
Closed 11 years ago
#2561 closed Feature Request (Rejected)
UDF - _ArrayPermute - proposal
Reported by: | mlipok | Owned by: | |
---|---|---|---|
Milestone: | Component: | Standard UDFs | |
Version: | Severity: | None | |
Keywords: | Cc: |
Description
now:
Func _ArrayPermute(ByRef $avArray, $sDelim = "") If Not IsArray($avArray) Then Return SetError(1, 0, 0) If UBound($avArray, 0) <> 1 Then Return SetError(2, 0, 0) Local $iSize = UBound($avArray), $iFactorial = 1, $aIdx[$iSize], $aResult[1], $iCount = 1 If UBound($avArray) Then For $i = 0 To $iSize - 1 $aIdx[$i] = $i Next For $i = $iSize To 1 Step -1 $iFactorial *= $i Next ReDim $aResult[$iFactorial + 1] $aResult[0] = $iFactorial __Array_ExeterInternal($avArray, 0, $iSize, $sDelim, $aIdx, $aResult, $iCount) Else $aResult[0] = 0 EndIf Return $aResult EndFunc ;==>_ArrayPermute
proposal
change:
If UBound($avArray) Then
to:
If $iSize Then
because: faster and cleaner
Attachments (0)
Change History (4)
comment:1 Changed 11 years ago by Jos
comment:3 Changed 11 years ago by mlipok
I have a few solutions that operate very strongly, with variables of type array.
The script is running slowly because a lot of data processing.
I can not identify changes in performance.
Overall, I look at the features available, and looking for possible improvements.
In this case, I think I was a little gone too far.
comment:4 Changed 11 years ago by Jos
- Resolution set to Rejected
- Status changed from new to closed
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Note: See
TracTickets for help on using
tickets.
Have you actually tested this and have proof as I believe the evaluation in the For statement is only done one time at its start so Ubound() is only done one time?
Jos