run.js 1.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.


load('../base.js');

new BenchmarkSuite('BasicExport', [100], [
  new Benchmark('BasicExport', false, false, 0, BasicExport)
]);

new BenchmarkSuite('BasicImport', [100], [
  new Benchmark('BasicImport', false, false, 0, BasicImport)
]);

new BenchmarkSuite('BasicNamespace', [100], [
  new Benchmark('BasicNamespace', false, false, 0, BasicNamespace)
]);

20
const iterations = 10000;
21 22 23 24


function BasicExport() {
  let success = false;
25
  import("basic-export.js").then(m => { m.bench(); success = true; });
26
  %PerformMicrotaskCheckpoint();
27 28 29 30 31
  if (!success) throw new Error(666);
}

function BasicImport() {
  let success = false;
32
  import("basic-import.js").then(m => { m.bench(); success = true; });
33
  %PerformMicrotaskCheckpoint();
34 35 36 37 38
  if (!success) throw new Error(666);
}

function BasicNamespace() {
  let success = false;
39
  import("basic-namespace.js").then(m => { m.bench(); success = true; });
40
  %PerformMicrotaskCheckpoint();
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
  if (!success) throw new Error(666);
}


var success = true;

function PrintResult(name, result) {
  print(name + '-Modules(Score): ' + result);
}

function PrintError(name, error) {
  PrintResult(name, error);
  success = false;
}


BenchmarkSuite.config.doWarmup = undefined;
BenchmarkSuite.config.doDeterministic = undefined;

BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
                           NotifyError: PrintError });