%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
Streamline.js and Node
1. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge
Digital Marketing Analytics with a Competitive Edge
Seth Pollack
Async Node Programming with
Streamline.js
February 17, 2015
2. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge2
if you use Node, you’d be nuts not to evaluate Streamline
codebase ~1/3 smaller
significant overall productivity gain (1.5x?)
more fun!
My Pitch: Node + Streamline
5. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge5
Key decision point for me is productivity
Node’s simple concurrency model is a win
JavaScript (expressiveness; one language everywhere) is a win
My “Why Node?”
6. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge6
Control flow with callbacks is clunky
Error handling is complex
Correct callback behavior is easy to get wrong
Node-body’s Perfect
7. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge7
My Path to Enlightenment
Node Rocks!
Control flow, ouch
Async lib!
Still painful…
Streamline!
Great Success!!!
Sadness….
9. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge9
Streamline lets you use standard control flow primitives for async
work
You write your control flow as if async functions were sync, and pass
a special token (“_”) as the callback parameter
Success results are presented as the return value of the function;
error response or exceptions are presented as a thrown exception
What is Streamline?
11. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge11
Simple control flow
Unified error handling
No need for manual callback invocation
PLUS…
JS tools work great
Better debugging
Logical stack trace
No wrappers
Transparent inter-op
Streamline FTW
13. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge13
Streamline is its own language, extremely similar to JavaScript
Streamline source JIT-ed into native JavaScript
Can target various back-ends (callbacks, fibers, generators)
Streamline yields and resumes on your behalf
Under the covers, the Node event loop continues to run; no blocking
or busy-waiting occurs
Under the Hood
14. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge14
Be sure to name your files *._js
You’ll have to use a different variable name than “_” for the
underscore library
The magic underscore token isn’t a function, it’s a keyword
It’s important to understand that the underscore means yield, and
when execution hits it, the event loop may run
Fibers backend to Streamline has best combo of performance and
developer experience
Many more goodies exist in Streamline that I haven’t covered here
Tips & Tricks
15. www.RivalIQ.comDigital Marketing Analytics with a Competitive Edge15
Some runtime overhead (very small slowdown, a bit more memory
usage)
• Extra work is only on async calls, we haven’t found it to be material
Since Streamline needs to keep up to date with JavaScript language
enhancements (current thinking is that new ES6 language features
to be handled by integrating 6to5)
With ES7 async/await, we may not need Streamline anymore. I can’t
wait ;-)
Streamline Drawbacks