Came across an article which says function referen...
# compose
m
Came across an article which says function references are slower than lambda. [Contd]
https://vtsen.hashnode.dev/prefer-function-reference-over-lambda-in-kotlin-wrong I have tried the same tests with kotlin version 2.0.0 release it turns out that the lambda test is just way slower than function reference.
The thing I am trying to ask is should we replace all lambda calls inside of our project to function reference and don't care much about performance as with k2 compiler its quite evident that it'll be much faster.
a
Does this performance difference matter in your project?
m
Practically speaking, No. Because the above test run a loop for 1 billion times.
a
How are you testing this? Are you sure you’re it’s not JIT at work? The article is not a valid microbenchmark for something like this anyway.
☝️ 1