https://kotlinlang.org logo
#announcements
Title
# announcements
d

danko9

03/16/2017, 1:38 PM
@vach Would you mind elaborating on your asSequeence() comment? Or sending a link?
v

vach

03/17/2017, 3:28 AM
sure so when i started with kotlin, i was using things extension methods on collections thinking that they actually use sequences or (java streams if i'm on 8)
so writing
list.map().filter()....
i was really intending to do
list.asSequence().map().filter()...
this was the first time i saw performance degradation, and at first i thought yeah kotlin is slow, but really its me messing up and not reading the docs... (plus an issue that still exists my idea wont show docs of kotlin code)
so basically list.map() will create a new collection then the next operator will create another after that.. wile if you use asSequence or even better java streams you might do much better...
2 Views