function? Would it be the same as if using kotlin std lib's
mapIndexed()
?
d
Dominaezzz
07/21/2021, 2:10 PM
Didn't think people actually used those micro optimized
fast
functions.
Dominaezzz
07/21/2021, 2:11 PM
Any reason not to just use stdlib?
👀 1
g
George Kylafas
07/21/2021, 3:14 PM
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
Adam Powell
07/21/2021, 4:10 PM
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
Adam Powell
07/21/2021, 4:13 PM
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