Do you mean doing something like that:

var workerPool = google.gears.factory.create('beta.workerpool');
workerPool.onmessage = function(a, b, message) {//MY DB function here}
workerPool.sendMessage(...);?

thanks!



On Apr 7, 12:09 am, Michael Nordman <[email protected]> wrote:
> Try this same test from within a worker and you should see dramatically
> better performance on Chrome.
> In Chrome, Gears is a plugin and executes in a seperate process than a page
> that is using Gears. What you're bumping into are performance penalties of
> doing IPC between the 'renderer' and 'plugin' processes. When you run the
> same test in a Gears worker, there penalty is not paid.
>
> Similary, if you run the same test in Firefox or IE, you should also see
> dramatically better performance in this test case since Gears runs in
> process on those browsers.
>
> If you arrange to do heavy DB work in a worker (iterate over large result
> sets), you'll get much better results in Chrome... and overall in all
> browsers since the UI will not be blocked by this work.
>
> 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/>");
> >                }

Reply via email to