runComputeTest function

int runComputeTest(
  1. ComputationCreator fn,
  2. int n,
  3. int scount,
  4. ReactiveFramework framework,
)

Implementation

int runComputeTest(
  ComputationCreator 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;
}