B4J Question Debug mode is much slower than Release mode when using resumable subs

xulihang

Active Member
Licensed User

xulihang

Active Member
Licensed User
Tested again on B4J 7.32. It is faster than the previous test. As this is debug mode, perhaps this result is reasonable. And it is an indication that my code needs optimization.

B4X:
Waiting for debugger to connect...
Program started.
A3 Start
start time: 12:30:10
end time: 12:30:38
A3 End
 

Erel

Administrator
Staff member
Licensed User
There were many improvements to the debugger in the recent versions. Still, you should never test performance in debug mode. The results are meaningless.
 

MarkusR

Well-Known Member
Licensed User
you should not use Dim inside a loop, it would create a new class object that is mostly unnecessary.

simple example:
at i 1,2,3 the output of a is empty
B4X:
Sub Test
   
    Dim i As Int
    For i = 0 To 3
        Dim a As String
        If i=0 Then a= "Hallo"
        Log(i)
        Log(a)
    Next
   
End Sub
about optimization,
count which sub is most used, also check which sub take the most time.
 
Top