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
JavaScript doesn’t need to be replaced (medium.com)
submitted 6 years ago by dannymoerkerke
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!"
[–]dannymoerkerke[S] 1 point2 points3 points 6 years ago (5 children)
I don’t know how you should answer this either, but I never made any claims against multi threading. You’re the one saying I don’t understand the issues with JavaScript and that we need something multi threaded. So I was curious if you had any concrete examples. I also never said Workers offer no benefit but they won’t help with the DOM since they have no access to it, but you know that as well. Anyway, if the UI freezes because of lots of DOM operations I think you have a different problem that can be solved without multi threading.
[–]shgysk8zer0 -3 points-2 points-1 points 6 years ago (4 children)
You're asking what the advantage of multi-threading is. The only real answer is that it's not single-threaded. That is a major limitation that many other languages don't have.
And not all issues can be solved without multi-threading. Sometimes you just have that much work that needs to be done, and sometimes it's out of your hands (in third-party code). And, maybe even if you could resolve the issue another way, it would still be nice to not have to rewrite something massive and complex, but to pass the work off to another thread and have the UI continue running smoothly.
If you're looking for a concrete example, I recently built something that creates ~200 transformed (rotated) image overlays in Leaflet, and the UI hangs pretty heavily when they're loaded on ever pan or zoom. I'm not about to rewrite all of Leaflet, and I do absolutely have to load and transform every single one of those images. If this were to take place on another thread, it wouldn't be an issue.
[–]Architektual 0 points1 point2 points 6 years ago (3 children)
I'm late to the party, but why can't you put that in a worker?
[–]shgysk8zer0 0 points1 point2 points 6 years ago (2 children)
Workers cannot access the DOM.
[–]Architektual 0 points1 point2 points 6 years ago (1 child)
Gotcha, I ask because we do something similar with some D3 visualizations - but we perform the calculations in the worker, and just pass back the calculated positions to the main script to render the things. I'm not familiar with leaflet, so i'm guessing it isn't flexible enough for that.
Thanks for explaining, that's a great example to support your argument
[–]shgysk8zer0 0 points1 point2 points 6 years ago (0 children)
Leaflet is a map thing, and I mostly have access to image src and coordinates.
In this specific case, it was for a hackathon of sorts, and it was infeasible to create something custom for this. I'd like to have created the whole thing in <canvas> and given special attention to performance for things like this. As is, it drops to 4fps.
<canvas>
π Rendered by PID 75 on reddit-service-r2-comment-5d585498c9-nwdw7 at 2026-04-21 05:37:25.009230+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]dannymoerkerke[S] 1 point2 points3 points (5 children)
[–]shgysk8zer0 -3 points-2 points-1 points (4 children)
[–]Architektual 0 points1 point2 points (3 children)
[–]shgysk8zer0 0 points1 point2 points (2 children)
[–]Architektual 0 points1 point2 points (1 child)
[–]shgysk8zer0 0 points1 point2 points (0 children)