W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2013

Re: [whatwg] asynchronous JSON.parse

From: Glenn Maynard <glenn@zewt.org>
Date: Thu, 7 Mar 2013 09:23:15 -0600
Message-ID: <CABirCh-CV9phmzQZ7nVHw6fQOy_C4YGVctUF5yorbamDnhgcPA@mail.gmail.com>
To: j@mailb.org
Cc: whatwg@lists.whatwg.org
(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

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:20 UTC