Re: [whatwg] asynchronous JSON.parse

(It's hard to talk to somebody called "j", by the way.  :)

On Thu, Mar 7, 2013 at 2:06 AM, <j@mailb.org> wrote:

> right now JSON.parse blocks the mainloop, this gets more and more of an
> issue as JSON documents get bigger


Just load the data you want to parse inside a worker, and perform the
parsing there.  Computationally-expensive work is exactly something Web
Workers are meant for.

and are also used as serialization
> format to communicate with web workers.
>

There's no need to serialize to JSON before sending data to a worker;
there's nothing that JSON can represent that postMessage can't post
directly.  Just postMessage the object itself.

-- 
Glenn Maynard

Received on Thursday, 7 March 2013 15:23:41 UTC