1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

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

Discussion in 'B4J Questions' started by xulihang, Jun 5, 2019.

  1. xulihang

    xulihang Active Member Licensed User

    I found that the debug mode is very slow when testing the project which I have uploaded at this thread:
    https://www.b4x.com/android/forum/t...en-many-subs-are-stringed.106328/#post-665791

    The result of processing a novel:

    Debug Mode

    Code:
    Waiting for debugger to connect...
    Program started.
    A3 Start
    start time: 
    10:12:28
    end time: 10:13:11
    A3 
    End

    Release Mode

    Code:
    A3 Start
    start time: 
    10:35:36
    end time: 10:35:42
    A3 
    End
     
  2. xulihang

    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.

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

    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.
     
  4. MarkusR

    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
    Code:
    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice