iOS Question Slow performance in for next

mrossen

Active Member
Licensed User
Longtime 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.

B4X:
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.

B4X:
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
 
Top