Viktor Qvarfordt
02/12/2020, 10:05 PMmap
and filter
. We have recently gone through the code wiht a profiler and this led us to use asSequence
so that we have myIterable.asSequence().map { .. }.map { .. }
. Why the compiler cannot make this optimization automatically? It’s quite obious that I’m not using the intermediate object.Sam Garfinkel
02/12/2020, 10:13 PMSequence.map
and Sequence.filter
return sequences, so they are evaluated lazily. If they are not pure then you could get end up with a completely different result from Iterable.map
and Iterable.filter
.Viktor Qvarfordt
02/12/2020, 10:16 PMFleshgrinder
02/12/2020, 10:40 PMasSequence
is the easiest route.Sam Garfinkel
02/13/2020, 3:41 PMFleshgrinder
02/13/2020, 10:17 PM