Displaying data in a table

Questions and information about using Lua scripting with Storyboard

Moderator: jamiev

Displaying data in a table

Postby DarkWishMaster » Mon Mar 17, 2014 8:08 am

Hello. I need some advice for the following issue:
I have a table with multiple columns, for example 10, and I want to display a lot of data there.
Basically my algorithm is this:
1) fetch the data from the database
2) display it via gre.set_data().
But, it is very slow. I ran some tests for time measurements, and the conclusion is that
it takes most of the time just to set up the data table, i.e
Code: Select all
data["layer.table.var.1.1"]  = "my data" 
data["layer.table.var.1.2"]  = "my data 2"  -- this operations takes a lot of time to perform
....
gre.set_data(data)

So how do you think the data should be displayed for better performance?
Thank You.
DarkWishMaster
 
Posts: 47
Joined: Wed Oct 23, 2013 6:23 am

Re: Displaying data in a table

Postby jason » Tue Mar 18, 2014 10:39 am

Are you able to share your example? It's hard to say without some instrumentation what is taking so much time

It could be
- Database access
- Lua function
- The data changes require new resources to be loaded and filesystem access is slow
- The target or app has rendering issues.

You can running logging and send us the log. This is how you do it on your desktop
http://www.cranksoftware.com/blog/?p=1056
User avatar
jason
 
Posts: 190
Joined: Mon Nov 02, 2009 4:53 pm

Re: Displaying data in a table

Postby DarkWishMaster » Wed Mar 19, 2014 10:32 am

Thank you for your reply. I guess I can't do the log because I use an sqlite database directly on android device.
But I ran some tests and I think the main reason is that it takes about 5 to 10 ms to call a java method and get data.
In java I have a object that represents the row with info on all columns.
so I do this:
data["..."] = java_object:getColumn(1)
data["..."] = java_object:getColumn(2)
....
and so on about 10 columns.
So just for a row it will take about 100 ms, which is a lot of time to display all the rows.
So I guess there is no way too speed up java calls...
DarkWishMaster
 
Posts: 47
Joined: Wed Oct 23, 2013 6:23 am

Re: Displaying data in a table

Postby mlove » Fri Mar 21, 2014 8:05 am

Is there any reason you need to access your sqlite database using java? Is it your own database that you have access to, or is it a system database? I would expect LuaJava calls to be a little slow since they need to go through multiple layers of JNI.

- Matt L
mlove
 
Posts: 22
Joined: Tue Apr 17, 2012 1:26 pm

Re: Displaying data in a table

Postby DarkWishMaster » Mon Mar 24, 2014 2:34 am

It's my own database, stored on android device SD card.
The first and the main reason is that I'm familiar with android sqlite, synchornization, threading etc.
And the second reason is that I didn't find too much on lua sqlite. If you have some good references, that will be very helpful.
Thank You.
DarkWishMaster
 
Posts: 47
Joined: Wed Oct 23, 2013 6:23 am

Re: Displaying data in a table

Postby JohnW » Thu May 08, 2014 9:29 am

Hey there!

If you have the ability to point to your sqlite database then I would suggest using the luasqlite lib. We have a compiled version for android if you'd like to try it out.
Attachments
android-armle.zip
The android version of luasqlite3
(248.77 KiB) Downloaded 245 times
User avatar
JohnW
 
Posts: 56
Joined: Wed May 08, 2013 4:52 pm

Re: Displaying data in a table

Postby Andrea » Fri Sep 01, 2017 7:40 am

..maybe you have a compiled version also for arm linux?
Andrea
 
Posts: 3
Joined: Wed Jun 21, 2017 10:19 am


Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron