5 ms·
"Useful Javascript stuff I can NOT use (because it implicitly blocks): Underscore.js" Huh? So what are we going to hear next: "Don't use prototype inheritance
by blago 15y ago
"Useful Javascript stuff I can NOT use (because it implicitly blocks): Underscore.js"
Huh? So what are we going to hear next: "Don't use prototype inheritance because chain traversal implicitly blocks"? Idiotic advise.
How about: Don't hold the event loop for too long. The faster you return, the faster you can serve.
- saurik 15y agoMaybe one day someone will invent a mechanism that can assign some kind of time slice to each event being processed, and if it doesn't return control to the master event coordinator, it could preempt that task somehow, storing the context in which it is executing, and switching to a different one: that way we could write code without having to worry about this kind of stuff. Thinking about it more, while most people are using these event loops to process unrelated web requests (the data being shared between these different contexts likely being small), we'd still run into mild data corruption issues. :( I guess we'd also then have to figure out a way to protect these critical sections of our code... maybe some way to lock people out of your data while you are using it. (Silly pipe dream, I know.) (edit: I've been thinking a lot about this idea, and I realized that once we figure out all of those critical sections in the code, we might actually be able to run multiple event loops on the same machine at once, taking advantage of multiple CPUs or other types of execution core, without having to make any other serious changes to our code. I'm starting to think someone should actually work on this.)