Is there a reason `androidx.compose.ui:ui-util:1.0...
# compose
g
Is there a reason
androidx.compose.ui:ui-util:1.0.0-rc02
includes a
fastMap()
but not a
fastMapIndexed()
function? Would it be the same as if using kotlin std lib's
mapIndexed()
?
d
Didn't think people actually used those micro optimized
fast
functions.
Any reason not to just use stdlib?
👀 1
g
I came across them today, while checking some standard Compose code. They supposedly avoid allocating iterators, so I guess they don't trigger garbage collection during composition as much. I don't know if they worth the fuss, though, so this is why I am asking.
a
they're worth the fuss in some very hot code paths that we identified by measuring and profiling in both macro and microbenchmarks. Don't worry about it unless/until you measure specific issues in your app.
👍 2
The compose libraries err on the side of caution in where to use them. It won't hurt anything if you use them too with collections that you know to be O(1) random access, but if you're in doubt, stick to the stdlib versions
👍 1