Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 669 Bytes

plugin-benchmark.md

File metadata and controls

26 lines (16 loc) · 669 Bytes

Benchmarking

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:

Benchmarking Output