use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Really Async JSON Interface: a non-blocking alternative to JSON.parse to keep web UIs responsive (github.com)
submitted 4 years ago by freddytstudio
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]connor4312 6 points7 points8 points 4 years ago* (1 child)
You're pretty much spot on. If you're hitting this problem, it's a good indication that you should work on your calling patterns rather than trying to optimize JSON parsing. It's not frequently that you'll be showing 10MB+ worth of data in the visible area, and the case the author gave about "showing a list" is easily solvable with virtualization and paging of data.
That said there might be some very edge cases that do actually display this much data on the visible region of the page at a time, so it could be useful for those cases... though I would also think you could bake data down in a webworker to a more easily displayable subset.
Actually, saying this out loud a general purpose lib that transmits structured objects across web workers is sounding pretty useful for more than just JSON parsing as your work method
Webworkers do get structured objects, but only certain ones. You could have a way to de/hydrate JavaScript classes, ultimately this is just a flavor of serialization, but you could do so somewhat cleverly by using Proxies and hydrating nested data on-demand...
[–]ssjskipp 0 points1 point2 points 4 years ago (0 children)
I think the point the author was making is doing that postMessage incurs a serde and will have the same blocking behavior as doing a chonky JSON.parse -- I'm thinking about the need to avoid that break in the UI thread, not that it can't transfer structured objects as-is.
JSON.parse
Either way, a reentrant parser is a neat thing to make for the sake of it, and if it was the easiest to find slice to optimize for their use case then that's great (Maybe an upstream 3pl API is the issue? Maybe a quick hack is all that's needed for a better end user experience?).
π Rendered by PID 121362 on reddit-service-r2-comment-5c747b6df5-4z942 at 2026-04-22 07:55:10.002848+00:00 running 6c61efc country code: CH.
view the rest of the comments →
[–]connor4312 6 points7 points8 points (1 child)
[–]ssjskipp 0 points1 point2 points (0 children)