runUpdateTest function

int runUpdateTest(
  1. UpdateTest fn,
  2. int n,
  3. int scount,
  4. ReactiveFramework framework,
)

Implementation

int runUpdateTest(
  UpdateTest fn,
  int n,
  int scount,
  ReactiveFramework framework,
) {
  final stopwatch = Stopwatch();

  framework.withBuild(() {
    var sources = createDataSignals(scount, [], framework);
    // Warm up
    fn(n ~/ 100, sources, framework);
    sources = createDataSignals(scount, [], framework);
    fn(n ~/ 100, sources, framework);
    sources = createDataSignals(scount, [], framework);
    fn(n ~/ 100, sources, framework);
    sources = createDataSignals(scount, [], framework);

    stopwatch
      ..reset()
      ..start();
    fn(n, sources, framework);
    stopwatch.stop();
  });

  return stopwatch.elapsedMicroseconds;
}