Re:Rich Hickey – Inside Transducers [video]
by grayrest on Friday November 21, 2014 @08:20AM
(#8641100)
Most people use underscore/lodash for this stuff. The difference is that the js transducers libraries don't create intermediate arrays, only do enough work to produce the requested output, and work on top of anything that can be coerced into the iteration protocol. I've seen demos of using Facebook's Immutable JS, CSP.js [1], and I don't see why you couldn't put them on top of Typed Arrays or a FRP library like Kefir.
Re:Rich Hickey – Inside Transducers [video]
by ultimape on Friday November 21, 2014 @08:30AM
(#8641135)
Yeah, the overhead of creating intermediate typed arrays is exactly what I'm trying to avoid with this.
Lo-Dash 3.0 will have support for lazy evaluation in its chaining syntax that supports shortcut fusion and avoids intermediate arrays as well.
For JS, I personally prefer lo-dash for this kind of work, or dropping in polyfills from MDN.
For some context, here are .map functions applied to normal arrays http://jsperf.com/native-vs-array-js-vs-underscore/54
I've been looking for similar libraries that work on typed-arrays because they are so much more efficient when working with web-workers or with raw canvas data. My attempts at hacking it in feel like they are just bad ideas: http://jsperf.com/float32array-map/2