Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 84
Registered: ‎06-26-2008
My Device: Not Specified
Accepted Solution

widget gears database throughput

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.

 

 

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: widget gears database throughput

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.

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 84
Registered: ‎06-26-2008
My Device: Not Specified

Re: widget gears database throughput

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=messages;    
    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=messages;
    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=messages;
    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=messages;
}

 

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 :-(

Developer
Posts: 84
Registered: ‎06-26-2008
My Device: Not Specified

Re: widget gears database throughput

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=messages;    
    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=messages;
    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=messages;
    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=messages;
}

Developer
Posts: 84
Registered: ‎06-26-2008
My Device: Not Specified

Re: widget gears database throughput

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?

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: widget gears database throughput

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?

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 84
Registered: ‎06-26-2008
My Device: Not Specified

Re: widget gears database throughput

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.

widget[2].png

Developer
Posts: 84
Registered: ‎06-26-2008
My Device: Not Specified

Re: widget gears database throughput

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.

 

 

Retired
Posts: 3,708
Registered: ‎10-16-2008
My Device: Z10
My Carrier: Rogers

Re: widget gears database throughput

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_Class_Rating

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Developer
Posts: 84
Registered: ‎06-26-2008
My Device: Not Specified

Re: widget gears database throughput

the SD card is the one that comes with the BB. I will try with another....