I wrote a very simple function with the intention ...
# announcements
d
I wrote a very simple function with the intention of seeing how it looked when decompiled:
Copy code
fun sequencesExample() {
    sequence<Int> {
        yield(5)
    }.forEach { println(it) }
}
When I decompiled it, I ended up with a 11,113-line monstrosity that takes 8.84MB! And it doesn't appear that
sequence
is even an inline function! What's going on here?
🧐 1
e
maybe tailrec or like something?
t
What decompiled do you use ? IDEA built-in compiler somehow struggle with decompiling code that uses coroutines and suspending lambda, like the
sequence
function. It shouldn't generate such a heavy binary though, I wrote an Android app that heavily uses coroutines and its whole size is low (most size is due to dependencies)
j
.forEach is a pig on sequences. same with Ranges.
t
Does not seem to generate that much bytecode : https://javap.yawk.at/#QYEVvz/procyon
d
I'm using the built-in IDEA decompiler. The bytecode looks fine, but decompiling it becomes a nightmare. (There's a section that's nested to the point of over 500 tabs.)