Android Question v3 BETA #3 sql performance issue in rapid debug

Alwinl

Member
Licensed User
Longtime User
I am populating a table using:

tbl.LoadSQLiteDB(SQL1, txtSQL.Text, True)

For 9 records with 20 or so columns it populates in under 2 seconds in legacy mode, in rapid mode it takes 55 seconds.


BTW the new edit-and-continue is amazing, it's something that I have always wanted - it will massively speed up development.
 

Alwinl

Member
Licensed User
Longtime User
Like I say, it's only 9 rows and it was fine before - something is way slower with the new rapid debug.

I agree that the SQL execution is not the problem but it seems that all the routines internal to the Table object that use loops, are slow (I doubt it's specific to the Table object)

eg. in Table.innerClearAll, the loop below takes forever (it is a nested loop, not sure if that's a factor)

For i = 1 To 80 'fill the cache to avoid delay on the first touch
LabelsCache.Add(CreateNewLabels)
Next

Perhaps the Table author can verify what I'm seeing
 
Upvote 0

Alwinl

Member
Licensed User
Longtime User
I am using a real device, the slowdown I experience is with beta#3 - I downloaded the link right now but still seem to have beta#3, is beta#4 available for download?
 
Upvote 0

Alwinl

Member
Licensed User
Longtime User
It's the same project I uploaded earlier but now this problem depends on data which come from a backend system. I'll try knock up a test app that shows the issue.
 
Upvote 0

Alwinl

Member
Licensed User
Longtime User
Ok, here's the test app. Using legacy debug the table populates quickly, with rapid debug it is very slow.
 

Attachments

  • perftest.zip
    22.7 KB · Views: 264
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Clearing the table class is a heavy operation. In your code you are clearing it twice as LoadSQLiteDB clears it again.

With this code, tested with beta #5 (which is not yet available) it takes 8 seconds to load.
B4X:
Sub btnRun_Click
   ProgressDialogShow("Running")
   Try
     Dim s As Long = DateTime.Now
     tbl.LoadSQLiteDB(sql1, "select * from data", True)
     Log(DateTime.Now - s)
   Catch
     ProgressDialogHide
     Msgbox(LastException.Message, "Error")
   End Try
   ProgressDialogHide
End Sub

It was helpful as there was an optimization that was not working properly. This is fixed for beta #5

The rapid debugger is slower compared to standard execution. There are cases where you should use the legacy debugger instead.
With that said I'm sure that with future versions of Basic4android it will become faster...
 
Upvote 0

Alwinl

Member
Licensed User
Longtime User
Thanks Erel, I expected the rapid debug to be slower then legacy but not to an order of 30 times :)

I'm sure the optimizations are the bit I need.
 
Upvote 0
Top