Which one is faster? ```SideEffect { if (!show) sh...
# compose
c
Which one is faster?
Copy code
SideEffect { if (!show) show = true }
Copy code
if (!show) SideEffect { show = true }
1
y
I'm guessing it usually doesn't matter. Unless you can measure a difference they are the same.
But since SideEffect executes after the composition is successful, the second can skip that additional execution when not required.
They are possibly also very subtly different, if other things can write to
show
also.
s
I think the first one won't trigger recomposition if you don't read
show
in other places
1
❤️ 2
d
Is there any general recommendation which one to use?
s
Not really, since they do slightly different things Pick whichever works for you