If you have a function you believe is slow, you can benchmark it to find any bottlenecks like this:
function slowFunction() {
const bench = Reactotron.benchmark("slow function benchmark")
// Code that does thing A
bench.step("Thing A")
// Code that does thing B
bench.step("Thing B")
// Code that does thing C
bench.stop("Thing C")
}
Note that the last call is to stop
instead of step
! This is important because otherwise the benchmark results won't display in Reactotron.
When slowFunction
is invoked, Reactotron should show something like this: