4 messages in com.googlegroups.google-gearsRe: [google-gears] Re: Passing messag...
FromSent OnAttachments
Felix Halim15 Oct 2007 20:09 
Scott Hess16 Oct 2007 09:37 
Felix Halim16 Oct 2007 11:14 
Aaron Boodman16 Oct 2007 13:08 
Subject:Re: [google-gears] Re: Passing messages other than string to WorkerPool
From:Felix Halim (feli@gmail.com)
Date:10/15/2007 08:09:11 PM
List:com.googlegroups.google-gears

Yes JSON can automate the process however the overhead to change back and forth to string still noticeable if the array is big (since toJSONString() is run on user GUI window not on worker) . It'll be nicer if array is allowed to be passed to worker pool, completely remove the overhead.

Moreover, JSON.js doesn't work inside the worker pool. So JSON code will need to be included in every worker pool. All I want is to pass an array, not a bunch of JSON code to worker pool :) Is there any way to make JSON work inside a worker? For example: to send message out from worker to other, you need JSON inside every worker.

Again it would be nice if every message passing structure is left as it is. No JSON, no overhead. ;)

On 10/16/07, Chris Prince <cpri@google.com> wrote:

You can use JSON to pass rich structures to a worker. In particular, take a look at toJSONString() here: http://www.json.org/js.html I think that will do what you're asking?

On 10/15/07, Felix Halim <feli@gmail.com> wrote:

Hi,

I'm planning to use GG to process an array of data (let say a result set). This array must be passed as a string to the WorkerPool. So currently I use array.split("separator") and array.join("separator") to convert back and forth from string to array and vice versa.

This creates unnecessary overhead, isn't it? Moreover, I need to use different separator for each dimension. Is there a better way to do this? Why WorkerPool only allow string? what's wrong with passing messages containing array? (is it because of fear that the object graph will be too large if the array is treated as an object and has many references to DOM?)