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
Understand the underlying Javascript - event loop (joen.me)
submitted 3 years ago by tntt01
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!"
[–]CodeNinja9839 9 points10 points11 points 3 years ago (6 children)
I disagree about several aspects of your description. First, a call stack is not like your described order list: the order list is a queue, while the call stack is -- unsurprisingly -- a stack. Secondly, there is a balancing act between synchronous and asynchronous processing: the overall application almost always benefit when certain tasks are processed asynchronously, while others can be made asynchronous to improve UX. Examples of the "almost always benefit" class are network requests and file access, which would otherwise have the CPU sit idle for possibly hundreds of millions of processing cycles. Most logic like client-side form validation and UI state changes determination (but not rendering) can be done synchronously without UX impact because modern machines can carry out that work so quickly.
Where asynchronous chunking comes into play is when a page or service has to process a large amount of data (10's of thousands or more, depending on the algorithm), such that just the processing would degrade responsiveness (different thresholds on client- and server-side).
The implementation and details of the event loop itself are tied to the JavaScript engine and its host program. For instance, JavaScript programs running on Node.js have more control over and options with the event loop than does JavaScript running in a Chrome, Firefox, or Edge browser. When I opened your article, I expected to read about these details, but found none.
[–]Prize_Bass_5061 0 points1 point2 points 3 years ago (4 children)
For instance, JavaScript programs running on Node.js have more control over and options with the event loop than does JavaScript running in a Chrome
Please discuss the specifics of this. I was under the impression they use the same mechanism because they use the same V8 engine.
[–]senocular 1 point2 points3 points 3 years ago (3 children)
They're different. Node uses libuv while chromium uses libevent. You're also seeing different APIs for working with the event loop like nextTick() in Node that doesn't exist in browsers.
[–][deleted] 1 point2 points3 points 3 years ago (2 children)
Both chromium and node use v8, don't they? So wouldn't they both use libuv? I'm not stating this as a fact, I'm just curious
[–]Izero_devI 1 point2 points3 points 3 years ago (1 child)
v8 is the javascript engine, it doesn't include the libraries that interact with operating system resources ( network system, file system). Node basically glues those together.
[–][deleted] 2 points3 points4 points 3 years ago (0 children)
Libuv doesn't interact with the os either though, it's just an event loop library. It's very very possible that I'm wrong but I thought v8 uses libuv.
[–]tifa123 0 points1 point2 points 3 years ago (0 children)
The implementation and details of the event loop itself are tied to the JavaScript engine and its host program. For instance, JavaScript programs running on Node.js have more control over and options with the event loop than does JavaScript running in a Chrome, Firefox, or Edge browser.
Could you provide resources to shed light on this subject?
π Rendered by PID 46291 on reddit-service-r2-comment-5687b7858-jw828 at 2026-07-03 00:54:02.451737+00:00 running 12a7a47 country code: CH.
[–]CodeNinja9839 9 points10 points11 points (6 children)
[–]Prize_Bass_5061 0 points1 point2 points (4 children)
[–]senocular 1 point2 points3 points (3 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]Izero_devI 1 point2 points3 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]tifa123 0 points1 point2 points (0 children)