Critical thinking in Node.js
-
Upload
morgan-cheng -
Category
Engineering
-
view
59 -
download
0
Transcript of Critical thinking in Node.js
Critical Thinking in Node.js
Morgan Cheng
What is Node.JS?
History• 2009, Ryan Dahl published Node.js• Bla Bla Bla
• https://blog.risingstack.com/history-of-node-js/
io.js & node.js
Why choose JavaScript?
JavaScript is clean in I/O
Asynchronous Programming
Scale Out? Scale Up?
Single Thread?IT IS A JOKE
Event Loop
"Everything runs in parallel except your code"
How about add Threading in JavaScript?
Promise vs CPS
CPS• Easy to callback-hell• High Performant
Promise• Seems winning
Rocks for I/O intensive job
Sucks for CPU intensive job
But, Node.js might still fail your Expectation
Watch Out
• Sync API• Loop•Recursion•GC
It Could Freeze You!
Garbage Collection
Real Single Threading
This is Node.js
Happy?
Any Question?