Javascript
Async & Performance
- Async behaviour
- Callback
- Promise
- Generator
- Async / await
- Performance
- Event Loop / Queue
- Provides non-blocking execution
- 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
- ES6 Native type
- Solves trust issues of callbacks
- Many good reasons to use it
-
yield keyword
- python has also generators
- Pausing execution of function
- Increase iteration capabilities
- Promise + generator
- Better and readable code
- Looks like sync but async
- 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