iOS Question Slow performance in for next

Discussion in 'iOS Questions' started by mrossen, Mar 29, 2015.

  1. mrossen

    mrossen Active Member Licensed User

    HI,

    I use at for next to loop a list. On my android device (HTC M8) it runs with ok speed.

    The similer code on my iPhone5 runs real slow.

    Is there a faster/smarter way to do this.

    Code:
    For i = 0 To brand_cars.Size - 1
            mCars = brand_cars.Get(i)
            tmpBrand = mCars.Get(
    "brand")
            
    Log(i)       
            fChar = tmpBrand.CharAt(
    0)
            
    If fChar = Cell.Text.ToString Then
                TableViewCars.SetSelection(SectionIndex, i)
                
    Log(tmpBrand)
                
    Return
            
    End If
        
    Next
    I use the log(i) see the speed in the log.

    If I rem the this section out it runs much faster.

    Code:
    If fChar = Cell.Text.ToString Then
                TableViewCars.SetSelection(SectionIndex, i)
                
    Log(tmpBrand)
                
    Return
            
    End If
    What I want to do is find ex. the first cell where the cell text starts with ex. a "T"

    Mogens
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is most probably the debugger that slows it down. Try this:
    - Tools - Clean Project
    - Edit - Remove all breakpoints
    Now run your app.

    If it is still slow, test it in release mode. You can use this tool to read the logs: iReleaseLogger - Read the logs in release mode
     
    mrossen likes this.
  3. mrossen

    mrossen Active Member Licensed User

    Your are a star :)

    Clean project did the job.

    Mogens
     
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