Presentations
Templates
Features
Teams
Pricing
Log in
Sign up
Log in
Sign up
Menu
Javascript
Async & Performance
Contents
Async behaviour
Callback
Promise
Generator
Async / await
Performance
Asynchronous Running
Event Loop / Queue
Provides non-blocking execution
Callbacks
A function for future call
Bad parts
Callback hell
Early call
Not called at all
Called few or many times
Fail to pass parameters
Swallow error/exceptions
Promises
ES6 Native type
Solves trust issues of callbacks
Many good reasons to use it
Generators
yield
keyword
python has also generators
Pausing execution of function
Increase iteration capabilities
async / await
Promise + generator
Better and readable code
Looks like sync but async
Performance
https://jsperf.com/
Donald Knuth:
"
Premature optimization is the root of all evil.
"
If you really don't sure about your need to optimize, simply don't do it
Web Workers !?
Look if you curious
Javascript - Async & Performance
By Özgün Bal
Javascript - Async & Performance
105
Özgün Bal
Software Developer, Javascript Enthusiast
More from
Özgün Bal