News for hackers. Stuff that matters.
Re:Transducers.js Round 2 with Benchmarks by bhouston on Sunday October 12, 2014 @08:52PM (#8447092)
In https://Clara.io we identified that _.each() and other types of function-based helpers were incredibly slow (even lodash was slow) and we had to replace these constructs in performance critical areas with raw for-loops. Three.JS we also did this.
Re:Transducers.js Round 2 with Benchmarks by cdsanchez on Sunday October 12, 2014 @05:21PM (#8446646)
I'd be really interested in knowing how it compares against lazy.js: http://danieltao.com/lazy.js/
Re:Transducers.js Round 2 with Benchmarks by ricardobeat on Sunday October 12, 2014 @06:20PM (#8446785)
My thoughts.

edit: added lazy.js to the benchmark and transducers.js wins hands down. Lazy also starts way behind _/lodash and only catches up after >50k elements.

Re:Transducers.js Round 2 with Benchmarks by michaelsbradley on Sunday October 12, 2014 @11:38PM (#8447396)
What about transducer support in David Nolen's mori library?

https://github.com/swannodette/mori

I would be interested to know how its transducer support and performance compares to transducers.js.

Re:Transducers.js Round 2 with Benchmarks by est on Sunday October 12, 2014 @09:18PM (#8447130)
Re:Transducers.js Round 2 with Benchmarks by Touche on Sunday October 12, 2014 @10:12PM (#8447242)
What problem does this solve? It seems to trade more-verbose code for being more performant in large datasets. That seems reasonable. But otherwise, in day-to-day code why would I use this?
Re:Transducers.js Round 2 with Benchmarks by juliangamble on Sunday October 12, 2014 @10:48PM (#8447309)
This is an example usage based on Dr Seuss: "Green Eggs and Transducers" via @gigasquid

http://gigasquidsoftware.com/blog/2014/09/06/green-eggs-and-...

(note this is in Clojure not JavaScript - but the ideas and usages are the same).

Re:Transducers.js Round 2 with Benchmarks by Thomasdah on Monday October 13, 2014 @08:35AM (#8448431)
The goal is to be less-verbose. You are able to use tansducer-based functions (map, filter, ...) on any datastructure that is iterable. For me, performance is a bonus.

I do not know how this compares to a monad/monoid. If anyone can explain, please go ahead. Thx!

Re:Transducers.js Round 2 with Benchmarks by tel on Monday October 13, 2014 @09:57AM (#8448714)
Monad/Monoid are a different category of things from transducers—think of them more like an interface than a thing. For instance, a basic model of Transducer is as follows

    type Trans a b = forall r . (r -> b -> r) -> (r -> a -> r)
and it turns out that this is isomorphic to (e.g. an optimization of) the list Kleisli arrow

    type KleiList a b = a -> [b]
and lists are monads. For a slightly different reason, this argumentation leads me to believe that Transducers ought to be monads via the Reader/List transformer stack. I haven't verified it, however.

Transducers could be monoids, too. You'd need to have two operations like so

    zero :: Transducer a b
    add  :: Transducer a b -> Transducer a b -> Transducer a b
and perhaps there would be necessary restrictions on the choices of `a` and `b`. It's immediately obvious we could make this work if `a` and `b` were equal

    zero :: Transducer a a
    add  :: Transducer a a -> Transducer a a -> Transducer a a
as this is now just the "identity" transducer and transducer composition which satisfy all the laws of monoid.
Re:Transducers.js Round 2 with Benchmarks by Touche on Monday October 13, 2014 @12:13PM (#8449292)
You are able to use transducers on any datastructure that implements the protocol. Which means usually implementing it yourself.

for/of solves this in JavaScript. I don't see the usability improvement this presents. I'm not being a naysayer. I hope I'm wrong here, I'm just asking.

Re:Transducers.js Round 2 with Benchmarks by coldtea on Sunday October 12, 2014 @10:57PM (#8447328)
Because lots of day-to-day uses large datasets? Especially since 10,000 item array is considered "large" from that perspective.
Re:Transducers.js Round 2 with Benchmarks by thesorrow on Monday October 13, 2014 @12:57AM (#8447546)
How does this compare to Bacon.js or higland ?
Re:Transducers.js Round 2 with Benchmarks by kbeaty on Monday October 13, 2014 @01:04AM (#8447564)
In regards to Bacon.js, tel had a very interesting response discussing transducers in relation to FRP/Reactive Programming in another thread [1].

[1]: https://news.ycombinator.com/item?id=8447046

Re:Transducers.js Round 2 with Benchmarks by jamesrom on Sunday October 12, 2014 @05:38PM (#8446694)
Time should be on the x-axis. Independent variables on the x-axis and dependent variables on the y.

EDIT: To clarify, plotting 'seconds' over 'items per second' is needlessly confusing.

Re:Transducers.js Round 2 with Benchmarks by dancole on Sunday October 12, 2014 @05:50PM (#8446717)
>> Independent variables on the x-axis and dependent variables on the y.

Correct. The independent variable being the number of items and the dependent variable being the time it takes to run said number of items.

>> Time should be on the x-axis.

Time should be on the y-axis. It's the time it takes to execute, given a set of items.

[deleted]
Re:Transducers.js Round 2 with Benchmarks by XaspR8d on Sunday October 12, 2014 @08:06PM (#8446997)
It's simply plotting 'seconds' over 'items'. Neither axis is a compound unit.
Re:Transducers.js Round 2 with Benchmarks by nmjohn on Sunday October 12, 2014 @05:49PM (#8446715)
> Time should be on the x-axis. Independent variables on the x-axis and dependent variables on the y.

The graph is correct - the independent variables in this case are the number of items in the array (the x axis) and the library being tested (each line).

The dependent variable in this case is time - which is why it is on the y axis.

Re:Transducers.js Round 2 with Benchmarks by mattdeboard on Sunday October 12, 2014 @07:51PM (#8446964)
I think you're just confused. From the post:

> The graph below shows the time it took to run versus the size of [the array]