You should see dramatically better performance if you wrap your work in a transaction. Have you tried that?
On Mon, Apr 6, 2009 at 1:57 PM, Ohad <[email protected]> wrote: > > I'm working on a framework that uses Gears as a major component, > it seems like there is a performance issue while using the local Gears > database(SQLite) > > I wrote a simple task* that creates a table(with one field), insert > 1000 rows,select all the rows from that table, and iterate the rows > one by one using a resultset, this task takes ~16-19 SECONDS!!! > does it make sense? > > I tried the same task* using Java/JDBC over MYSQL(local) and it takes > ~1.5 second... > > when I reduce the amount of rows from 1000 to 100, Gears finished the > task in less than 2 second (which is still a lot) , comparing to java > the situation is not that bad( ~500ms). > > so it seems like that the performance problem exists when I increase > the number of rows....it seems like an exponential growth.. > any thoughts? any ideas? > > I'm working with the Chrome browser (Windows vista) > > here is the JS code I'm using: > function db(){ > var currentTime = new Date().getTime(); > var db = google.gears.factory.create("beta.database"); > db.open("gearsDb"); > db.execute("delete from data2"); > db.execute("create table if not exists data2 (rowId > int)"); > for(i=0;i<100;i++) > db.execute("insert into data2 values ("+i+")"); > var rs = db.execute("select rowId from data2"); > while (rs.isValidRow()){ > rs.field(0); > rs.next(); > } > rs.close(); > var currentTime2 = new Date().getTime(); > currentTime2 -=currentTime; > document.write(currentTime2 + "<BR/>"); > } >
