[whatwg] asynchronous JSON.parse

Glenn Maynard glenn at zewt.org
Thu Mar 7 07:23:15 PST 2013


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

On Thu, Mar 7, 2013 at 2:06 AM, <j at 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



More information about the whatwg mailing list