Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: test/codegen/expect/BenchmarkBase.js

Issue 1074923003: rename dart_runtime.js helpers (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/cascade.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var BenchmarkBase; 1 var BenchmarkBase;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class Expect extends core.Object { 4 class Expect extends core.Object {
5 static equals(expected, actual) { 5 static equals(expected, actual) {
6 if (!dart.equals(expected, actual)) { 6 if (!dart.equals(expected, actual)) {
7 throw `Values not equal: ${expected} vs ${actual}`; 7 throw `Values not equal: ${expected} vs ${actual}`;
8 } 8 }
9 } 9 }
10 static listEquals(expected, actual) { 10 static listEquals(expected, actual) {
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 setup() {} 35 setup() {}
36 teardown() {} 36 teardown() {}
37 static measureFor(f, timeMinimum) { 37 static measureFor(f, timeMinimum) {
38 let time = 0; 38 let time = 0;
39 let iter = 0; 39 let iter = 0;
40 let watch = new core.Stopwatch(); 40 let watch = new core.Stopwatch();
41 watch.start(); 41 watch.start();
42 let elapsed = 0; 42 let elapsed = 0;
43 while (dart.notNull(elapsed) < dart.notNull(timeMinimum)) { 43 while (dart.notNull(elapsed) < dart.notNull(timeMinimum)) {
44 dart.dinvokef(f); 44 dart.dcall(f);
45 elapsed = watch.elapsedMilliseconds; 45 elapsed = watch.elapsedMilliseconds;
46 iter = dart.notNull(iter) + 1; 46 iter = dart.notNull(iter) + 1;
47 } 47 }
48 return 1000.0 * dart.notNull(elapsed) / dart.notNull(iter); 48 return 1000.0 * dart.notNull(elapsed) / dart.notNull(iter);
49 } 49 }
50 measure() { 50 measure() {
51 this.setup(); 51 this.setup();
52 BenchmarkBase.measureFor((() => { 52 BenchmarkBase.measureFor((() => {
53 this.warmup(); 53 this.warmup();
54 }).bind(this), 100); 54 }).bind(this), 100);
55 let result = BenchmarkBase.measureFor((() => { 55 let result = BenchmarkBase.measureFor((() => {
56 this.exercise(); 56 this.exercise();
57 }).bind(this), 2000); 57 }).bind(this), 2000);
58 this.teardown(); 58 this.teardown();
59 return result; 59 return result;
60 } 60 }
61 report() { 61 report() {
62 let score = this.measure(); 62 let score = this.measure();
63 core.print(`${this.name}(RunTime): ${score} us.`); 63 core.print(`${this.name}(RunTime): ${score} us.`);
64 } 64 }
65 } 65 }
66 // Exports: 66 // Exports:
67 exports.Expect = Expect; 67 exports.Expect = Expect;
68 exports.BenchmarkBase = BenchmarkBase; 68 exports.BenchmarkBase = BenchmarkBase;
69 })(BenchmarkBase || (BenchmarkBase = {})); 69 })(BenchmarkBase || (BenchmarkBase = {}));
OLDNEW
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/cascade.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698