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: 191
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 325 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: 9
Joined: Wed Jun 21, 2017 10:19 am

Re: Displaying data in a table

Postby Andrea » Thu Jan 18, 2018 7:03 am

I'm trying to use a lua_sqlite3 module for arm.
I have already found and installed such a module through luarocks on my beaglebone. However, when SB engine tries to load it at startup, it gives this error:

ERROR [0.208]:Problem loading Lua script [dbManager.lua] error loading module 'luasql_sqlite3' from file '/usr/local/lib/lua/5.1/luasql_sqlite3.so':
/usr/local/lib/lua/5.1/luasql_sqlite3.so: undefined symbol: lua_settop

It is true that this symbol is undefined in the script, however it is referred to a standard lua function, so that: should it really be defined there?
I had a look to the same module that you provided as default for linux 386 systems and also in this module it seems that this symbol is not defined (I didn't tried to use that module in a 386 environment but I assume that it is working).
Do you have any suggestion for me?
Andrea
 
Posts: 9
Joined: Wed Jun 21, 2017 10:19 am

Re: Displaying data in a table

Postby thomas » Thu Jan 18, 2018 7:59 am

Andrea,

It looks to me as though you are mixing pre-built Lua modules for your board (based on the path) and Lua modules build against Storyboard's flavour of Lua (libsblua.so).

While I can't speak to the Lua sqlite module you have on your beaglebone, our flavour of Lua is a patched version of Lua 5.1 and we have added in thread support and added our own extensions. For this reason we name it libsblua.so.

I suspect that the sqlite library you are referencing is picking up symbols somewhere else or wasn't linked against our libsblua.so library ... which would imply that you actually have two Lua flavours (or maybe even versions) loaded. If you run objdump -x on the /usr/local/lib/lua/5.1/luasql_sqlite3.so file, what depenendencies do you see? If they aren't against libsblua.so then you are cross using two different libraries and are in for unpredictable results.

Hope this helps,
Thomas
thomas
 
Posts: 130
Joined: Mon Nov 02, 2009 4:32 pm
Location: Ottawa

Re: Displaying data in a table

Postby Andrea » Thu Jan 25, 2018 8:14 am

Thank you for your reply Thomas. It took 1 week of study to get me aquainted with the environment, but at the end, restarting from a clean environment, I could successfully compile the right connector and link it to your Lua flavour.. very easy to do indeed - when you know how to do it. The important thing is that now it is working properly
Andrea
 
Posts: 9
Joined: Wed Jun 21, 2017 10:19 am

Next

Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 1 guest

cron