thelumiereguy
12/13/2022, 5:03 PMLocalComposition.current.colors.primary
and LocalComposition.current.colors.secondary
.
Would this incur any overheads?mattinger
12/14/2022, 2:56 AMval currentComposer: Composer
@ReadOnlyComposable
@Composable get() { throw NotImplementedError("Implemented as an intrinsic") }
Once you have the current composer, there's essentially a map lookup to retrieve the value associated with the CompositionLocal being requested.
So, yes, there is overhead for sure due to the map lookup. To what degree i'm not certain without knowing how this function gets implemented.
The other thing i would say is that if you're not noticing a performance problem, don't worry about it. Premature optimization is rarely worth the effort, and unless you are accessing these values in sort of extended loop, it's likely to not make much difference.myanmarking
12/14/2022, 10:12 AM