Suraj Shah
06/22/2019, 1:08 PMinline
to inline lambdas in a function marked with @Composable
or does the annotation processor optimize it for you?cbruegg
06/22/2019, 2:24 PMLeland Richardson [G]
06/22/2019, 4:23 PMlouiscad
06/22/2019, 4:35 PMwithPrideHeaderAndFooter
to be inlined at call site.
@Composable inline fun withPrideHeaderAndFooter(content: @Composable() () -> Unit) {
VerticalStack {
ManyCodeForPrideHeader() // Let's assume there's more code there that we don't want to inline.
content()
ManyCodeForPrideFooter() // Same as header.
}
}
The solution would be that the generated code looks like this at call site:
withPrideHeaderAndFooter(before = true) // Runs VerticalStack(before = true) and ManyCodeForPrideHeader()
content() // our lambda is inlined
withPrideHeaderAndFooter(before = false) // Runs VerticalStack(before = false) and ManyCodeForPrideFooter()
instead of looking like this:
VerticalStack { // Possibly much code inlined
ManyCodeForPrideHeader() // Much code inlined
content() // We just wanted to inline this lambda
ManyCodeForPrideFooter() // Much code inlined
}
That may be a little more complex to do if finally
(and catch
) blocks are allowed in @Composable
functions.Leland Richardson [G]
06/22/2019, 4:37 PMlouiscad
06/22/2019, 4:39 PMromainguy
06/22/2019, 4:51 PMSuraj Shah
06/24/2019, 7:46 AMBINARY
is that different from SOURCE
in terms of bloating and processing?cbruegg
06/24/2019, 8:48 AMRyan Mentley
06/24/2019, 6:07 PMcbruegg
06/24/2019, 6:09 PMRyan Mentley
06/24/2019, 6:10 PMLeland Richardson [G]
06/24/2019, 6:36 PMlouiscad
06/24/2019, 7:27 PM