- Fernando Leal
- PowerBuilder
- Sunday, 15 November 2020 01:31 PM UTC
Hi People,
How can I Optimize FOR statement in PB2019?
I have noticed that these loops produce a 90 second delay.
nteger row, col, colByte, col2, k, l, i
long cols
byte lb_char
int Rows
Rows = lngHeight
cols =ll_ancho_col //lngWidth -comentado agregar ancho columna entero
k = 0
For row = 0 To Rows - 1
For colByte = 0 To lngRowSize - 1
lb_char = ly_byte[((row * lngRowSize) + colByte + 1)+ lngOffset ]
For i = 7 To 0 Step -1
col = (colByte * 8) + i
If col < Cols Then
//pict.Dot(row + 1, col + 1) = MOD(lb_char,2)
lb_Array[row + 1, col + 1] = MOD(lb_char,2)
End If
lb_char = byte(truncate(int(lb_char) / 2,0))//Fix(lb_char / 2)
Next //i
Next //colByte
k = k + 1
Next //row
//
//Dim strHeader
// Dim strImage
//
byte lb_char2
string strImage =""
string strHeader
string C_FL = char(13) + char(10)
li_col_x_col = li_columna
//comentado para prueba
k = 0
string ls_concatenar
int li_valid_col = 1
For row = Rows To 1 Step -1
For col = 1 To Cols
//i = pict.Dot(row, col)
i = lb_Array[row,col]
lb_char2 = lb_char2 + (i * (2 ^ (3 - k)))
k = k + 1
ls_concatenar = ls_concatenar + string(i)
If k = 4 Then
lb_char2 = 15 - lb_char2
if lb_char2 <= 9 then
strImage = strImage + string(lb_char2)
else
choose case lb_char2
case 10
strImage = strImage + "A"
case 11
strImage = strImage + "B"
case 12
strImage = strImage + "C"
case 13
strImage = strImage + "D"
case 14
strImage = strImage + "E"
case 15
strImage = strImage + "F"
end choose
end if
k = 0
lb_char2 = 0
End If
// //primera línea ponerle el salto de carro ya que sobrepasa la matriz definida
if len(strImage) = li_columna then
strImage = strImage + C_FL
//continue;
end if
Next //col
If row <> Rows Then
strImage = strImage + C_FL
End If
Next //row
//Cerramos el archivo
FileClose(li_File)
thanks and regards,
Fernando.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.