04-16-2010 09:42 AM
Hi all, i'm doing some test to know if widget is good enough to use in some heavy scenarios.
I'm specially worried about gears database. In my tests, doing 10 inserts take 1-2 seconds in the storm2 emulator, but in my Bold 9700 it takes 18 seconds, near 2 seconds per insert¡
Is this the normal throughput?
My Bold 9700 use the 5.0.0.321 OS.
Solved! Go to Solution.
04-16-2010 04:10 PM
Hi lasterra,
Are you explicitly closing your RecordSet objects with a "close()" after you are done with them. If you do not they will cause a leak in memory that can slow things down.
04-19-2010 07:55 AM
this is the test i'm doing
function testdb(){
var start = new Date().getTime();
var db = google.gears.factory.create('beta.database');
var messages = "Time for google factory = " + (new Date().getTime() - start);
db.open('widget');
messages = messages + "\nTime for widget db = " + (new Date().getTime() - start);
document.getElementById("result").innerHTML=messa
db.execute('drop table if exists Sample');
db.execute('create table if not exists Sample (Code text, Sampletext text)');
messages = messages + "\nTime for create DB = " + (new Date().getTime() - start);
document.getElementById("result").innerHTML=messa
db.execute("insert into Sample values (?,?)", ['0','0'] );
for (var i=0;i<10;i++){
db.execute("insert into Sample (Code,Sampletext) values (?, ?)", ['0','0'] );
}
messages = messages + "\nTime for inserting 10 lines = " + (new Date().getTime() - start);
document.getElementById("result").innerHTML=messa
var rs = db.execute("SELECT * from Sample where Code > ?",[8]);
messages = messages + "\nTime for select 1 line = " + (new Date().getTime() - start);
var arrayPedidos = new Array();
while (rs.isValidRow()) {
var pedido = ""+ rs.fieldByName("Code") + " " + rs.fieldByName("Sampletext");
arrayPedidos.push(pedido);
rs.next();
}
rs.close();
messages = messages + "\nTime reading rs = " + (new Date().getTime() - start);
document.getElementById("result").innerHTML=messa
}
It's run very fast on the Storm2 5.0.0.469 emulator, very slowly on a real Bold 2 with OS version 5.0.0.321 (499) and doesn't run withour errors on console on the Bold2 5.0.0.469 emulator :-(
04-19-2010 08:01 AM
Sorry i make a mistake translating the code, this is better.
function testdb(){
var start = new Date().getTime();
var db = google.gears.factory.create('beta.database');
var messages = "Time for google factory = " + (new Date().getTime() - start);
db.open('widget');
messages = messages + "\nTime for widget db = " + (new Date().getTime() - start);
document.getElementById("result").innerHTML=messa
db.execute('drop table if exists Sample');
db.execute('create table if not exists Sample (Code text, Sampletext text)');
messages = messages + "\nTime for create DB = " + (new Date().getTime() - start);
document.getElementById("result").innerHTML=messa
for (var i=0;i<10;i++){
db.execute("insert into Sample (Code,Sampletext) values (?, ?)", [i, 'text ' + i] );
}
messages = messages + "\nTime for inserting 10 lines = " + (new Date().getTime() - start);
document.getElementById("result").innerHTML=messa
var rs = db.execute("SELECT * from Sample where Code > ?",[8]);
messages = messages + "\nTime for select 1 line = " + (new Date().getTime() - start);
var arrayPedidos = new Array();
while (rs.isValidRow()) {
var pedido = ""+ rs.fieldByName("Code") + " " + rs.fieldByName("Sampletext");
arrayPedidos.push(pedido);
rs.next();
}
rs.close();
messages = messages + "\nTime reading rs = " + (new Date().getTime() - start);
document.getElementById("result").innerHTML=messa
}
04-19-2010 12:48 PM
I discover two things
1.- Related to the problems on the Bold2 simulater, i take care that it doesn't have an SD card. Creating an SD card file, the project run perfectly. I read that bold2 have an eMMC memory where the SQLLite database should be installed.. so this should not be necesary, isn't it?
2.- I discover that there is a DatabaseException on the real bold2 device:
Nombre: net.rim.mango
GUID: 20a419c4b23001ae
Hora: 19 abr 2010 18:18:14
net.rim.device.api.database.DatabaseException: insert into Sample values (?,?): SQL logic error or missing database
Running at line 14: db.execute("insert into Sample values (?,?)",[""+i,"texto for line "+i]);}.
Called from line 1: testdb();} } } }.
Any ideas?
04-19-2010 01:27 PM
1.- Related to the problems on the Bold2 simulater, i take care that it doesn't have an SD card. Creating an SD card file, the project run perfectly. I read that bold2 have an eMMC memory where the SQLLite database should be installed.. so this should not be necessary, isn't it?
The Bold2 (9700) Does not have a built in eMMC card. Only the Bold1 (9000) and the Storm series of devices have a built in eMMC card. So an SDCard will be necessary for Bold2
2.- I discover that there is a DatabaseException on the real bold2 device:
Does this Bold2 (9700) have an SDCard inserted? Can you post up the OS version that is running on the Bold2?
04-19-2010 01:53 PM
1.-Sorry i was thinking that bold2 has also eMMC memory ;-(
2.- yes it has an SD Card. I remove the DB and the code runs again without the exception, but it's still very slowly. 159 seconds inserting 100 records on the new db. other operations (open db, create table, and select runs very fast.
i repeat the test several times, and sometimes the time go down to 10 seconds, but normally it take 150-180 seconds.
I append an screncaps of the app on the real bold2.
thanks.
04-19-2010 02:00 PM
Sorry i forgot to response the question about the OS of the real bold2
It is the 5.0.0.321 (499) - platform 5.1.0.90 from vodafone spain.
04-21-2010 05:48 AM
What is the speed rating of your SD Card? This will directly affect your read/write speeds for SQLite. It should be printed right on your SD Card.
http://en.wikipedia.org/wiki/Secure_Digital#Speed_
04-21-2010 06:12 AM
the SD card is the one that comes with the BB. I will try with another....