Jannis
12/20/2019, 4:26 PMtraverse
. Apart from traverse
now being left to right for (all?) functors, this should not affect any existing code.simon.vergauwen
12/20/2019, 5:32 PMEval
and there are a couple of small improvements that can be made that I see immediately but nothing that would significantly speed it up.Jannis
12/20/2019, 5:45 PMgenerateSequence(0) { it + 1 }.take(10000).traverse(IO.applicative()) { IO { println(it) } }
takes a longer than my patience offers (upwards 5-10 min the last time I think, and my laptop is by no means slow). It does the first 1k and then gradually slows down.
traverse_
is equally slow, so I think it's on foldRight
and likely on Eval
. Do we even need it? We just need basic laziness not all the extras Eval
brings, right? That is also the reason I chose lazyAp(ff: () -> ...)
instead of lazyAp(ff: Eval<...>)
. This might also be on sequences, but since even traverse_
is not faster I think it's less likely. I'll retry with lists...traverse_
, same thing, slowdown comes a bit later, but still not fast. It goes from 100s per refresh on the terminal to 10s to 1straverse
. generateSequence(0) { it + 1 }.take(10000).map { println(it) }
is also slowing down after the ~1.5k element mark. Just not as much as traverse
. Funsimon.vergauwen
12/20/2019, 6:00 PMSequence
. That was also my first suspect, that’s why I jumped into the code.Sequence
in Arrow-optics which are horribly slow compared to the other testsDo we even need it? We just need basic laziness not all the extrasAll the instances that can be rewritten withoutbrings, right?Eval
Eval
probably should. If the laws hold then performance wins over Eval 😄Jannis
12/20/2019, 6:09 PMgenerateSequence
as a stateful iterator which means at any point it' just current state + the same lambda that was passed before. This should be fast. It also slows down considerable without take(10000)
so thats not it either.Function0
other than memoization?simon.vergauwen
12/20/2019, 6:20 PMSequence
since it also relies on suspension IIRCRegarding eval, it makes for quite the ugly api, does it offer any benefit overNot sure actual. Haven’t used either a lot.other than memoization?Function0
Jannis
12/20/2019, 10:16 PMsimon.vergauwen
12/21/2019, 9:01 AM