HI!
I'm making a pathfinding code. The problem is that it gets slower and slower the more I use it. I've isolated the slowdown to these lines of code, but I find nothing wrong with them. It gets so bad that it only manages 2000 iterations a second.
Edit: Fs() is an array
Const t0 =2^0
Const t1 =2^1
Const t2 =2^2
Const t3 =2^3
...
Const t20=2^20
Dim Fs(2^20-1)
Type Square
Field x,y
Field F
Field G
Field H
Field n
Field n2
Field Previous.Square
End Type
tmp=MilliSecs()
For o.Square=Each Square
p=t19+((o\F And t18) Shr 17-1) Shl 18
Fs(p)=0
p=p +((o\F And t17) Shr 16-1) Shl 17
Fs(p)=0
p=p +((o\F And t16) Shr 15-1) Shl 16
Fs(p)=0
p=p +((o\F And t15) Shr 14-1) Shl 15
Fs(p)=0
p=p +((o\F And t14) Shr 13-1) Shl 14
Fs(p)=0
p=p +((o\F And t13) Shr 12-1) Shl 13
Fs(p)=0
p=p +((o\F And t12) Shr 11-1) Shl 12
Fs(p)=0
p=p +((o\F And t11) Shr 10-1) Shl 11
Fs(p)=0
p=p +((o\F And t10) Shr 9 -1) Shl 10
Fs(p)=0
p=p +((o\F And t9 ) Shr 8 -1) Shl 9
Fs(p)=0
p=p +((o\F And t8 ) Shr 7 -1) Shl 8
Fs(p)=0
p=p +((o\F And t7 ) Shr 6 -1) Shl 7
Fs(p)=0
p=p +((o\F And t6 ) Shr 5 -1) Shl 6
Fs(p)=0
p=p +((o\F And t5 ) Shr 4 -1) Shl 5
Fs(p)=0
p=p +((o\F And t4 ) Shr 3 -1) Shl 4
Fs(p)=0
p=p +((o\F And t3 ) Shr 2 -1) Shl 3
Fs(p)=0
p=p +((o\F And t2 ) Shr 1 -1) Shl 2
Fs(p)=0
p=p +((o\F And t1 ) -1) Shl 1
Fs(p)=0
p=p +((o\F And t0 ) Shl 1 -1)
Fs(p)=0
Next
clean=(MilliSecs()-tmp)