| OLD | NEW |
| 1 define(['dart_sdk'], function(dart_sdk) { | 1 define(['dart_sdk'], function(dart_sdk) { |
| 2 'use strict'; | 2 'use strict'; |
| 3 const core = dart_sdk.core; | 3 const core = dart_sdk.core; |
| 4 const dart = dart_sdk.dart; | 4 const dart = dart_sdk.dart; |
| 5 const dartx = dart_sdk.dartx; | 5 const dartx = dart_sdk.dartx; |
| 6 const BenchmarkBase$ = Object.create(null); | 6 const BenchmarkBase$ = Object.create(null); |
| 7 const $length = dartx.length; |
| 8 const $_get = dartx._get; |
| 7 let VoidToNull = () => (VoidToNull = dart.constFn(dart.fnType(core.Null, [])))
(); | 9 let VoidToNull = () => (VoidToNull = dart.constFn(dart.fnType(core.Null, [])))
(); |
| 8 BenchmarkBase$.Expect = class Expect extends core.Object { | 10 BenchmarkBase$.Expect = class Expect extends core.Object { |
| 9 static equals(expected, actual) { | 11 static equals(expected, actual) { |
| 10 if (!dart.equals(expected, actual)) { | 12 if (!dart.equals(expected, actual)) { |
| 11 dart.throw(dart.str`Values not equal: ${expected} vs ${actual}`); | 13 dart.throw(dart.str`Values not equal: ${expected} vs ${actual}`); |
| 12 } | 14 } |
| 13 } | 15 } |
| 14 static listEquals(expected, actual) { | 16 static listEquals(expected, actual) { |
| 15 if (expected[dartx.length] != actual[dartx.length]) { | 17 if (expected[$length] != actual[$length]) { |
| 16 dart.throw(dart.str`Lists have different lengths: ${expected[dartx.lengt
h]} vs ${actual[dartx.length]}`); | 18 dart.throw(dart.str`Lists have different lengths: ${expected[$length]} v
s ${actual[$length]}`); |
| 17 } | 19 } |
| 18 for (let i = 0; i < dart.notNull(actual[dartx.length]); i++) { | 20 for (let i = 0; i < dart.notNull(actual[$length]); i++) { |
| 19 BenchmarkBase$.Expect.equals(expected[dartx._get](i), actual[dartx._get]
(i)); | 21 BenchmarkBase$.Expect.equals(expected[$_get](i), actual[$_get](i)); |
| 20 } | 22 } |
| 21 } | 23 } |
| 22 fail(message) { | 24 fail(message) { |
| 23 dart.throw(message); | 25 dart.throw(message); |
| 24 } | 26 } |
| 25 }; | 27 }; |
| 26 (BenchmarkBase$.Expect.new = function() { | 28 (BenchmarkBase$.Expect.new = function() { |
| 27 }).prototype = BenchmarkBase$.Expect.prototype; | 29 }).prototype = BenchmarkBase$.Expect.prototype; |
| 30 dart.addTypeTests(BenchmarkBase$.Expect); |
| 28 dart.setSignature(BenchmarkBase$.Expect, { | 31 dart.setSignature(BenchmarkBase$.Expect, { |
| 29 methods: () => ({fail: dart.fnType(dart.dynamic, [dart.dynamic])}), | 32 methods: () => ({fail: dart.fnType(dart.dynamic, [dart.dynamic])}), |
| 30 statics: () => ({ | 33 statics: () => ({ |
| 31 equals: dart.fnType(dart.void, [dart.dynamic, dart.dynamic]), | 34 equals: dart.fnType(dart.void, [dart.dynamic, dart.dynamic]), |
| 32 listEquals: dart.fnType(dart.void, [core.List, core.List]) | 35 listEquals: dart.fnType(dart.void, [core.List, core.List]) |
| 33 }), | 36 }), |
| 34 names: ['equals', 'listEquals'] | 37 names: ['equals', 'listEquals'] |
| 35 }); | 38 }); |
| 36 BenchmarkBase$.BenchmarkBase = class BenchmarkBase extends core.Object { | 39 BenchmarkBase$.BenchmarkBase = class BenchmarkBase extends core.Object { |
| 37 get name() { | 40 get name() { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 return result; | 79 return result; |
| 77 } | 80 } |
| 78 report() { | 81 report() { |
| 79 let score = this.measure(); | 82 let score = this.measure(); |
| 80 core.print(dart.str`${this.name}(RunTime): ${score} us.`); | 83 core.print(dart.str`${this.name}(RunTime): ${score} us.`); |
| 81 } | 84 } |
| 82 }; | 85 }; |
| 83 (BenchmarkBase$.BenchmarkBase.new = function(name) { | 86 (BenchmarkBase$.BenchmarkBase.new = function(name) { |
| 84 this[name$] = name; | 87 this[name$] = name; |
| 85 }).prototype = BenchmarkBase$.BenchmarkBase.prototype; | 88 }).prototype = BenchmarkBase$.BenchmarkBase.prototype; |
| 89 dart.addTypeTests(BenchmarkBase$.BenchmarkBase); |
| 86 const name$ = Symbol("BenchmarkBase.name"); | 90 const name$ = Symbol("BenchmarkBase.name"); |
| 87 dart.setSignature(BenchmarkBase$.BenchmarkBase, { | 91 dart.setSignature(BenchmarkBase$.BenchmarkBase, { |
| 88 fields: () => ({name: dart.finalFieldType(core.String)}), | 92 fields: () => ({name: dart.finalFieldType(core.String)}), |
| 89 methods: () => ({ | 93 methods: () => ({ |
| 90 run: dart.fnType(dart.void, []), | 94 run: dart.fnType(dart.void, []), |
| 91 warmup: dart.fnType(dart.void, []), | 95 warmup: dart.fnType(dart.void, []), |
| 92 exercise: dart.fnType(dart.void, []), | 96 exercise: dart.fnType(dart.void, []), |
| 93 setup: dart.fnType(dart.void, []), | 97 setup: dart.fnType(dart.void, []), |
| 94 teardown: dart.fnType(dart.void, []), | 98 teardown: dart.fnType(dart.void, []), |
| 95 measure: dart.fnType(core.double, []), | 99 measure: dart.fnType(core.double, []), |
| 96 report: dart.fnType(dart.void, []) | 100 report: dart.fnType(dart.void, []) |
| 97 }), | 101 }), |
| 98 statics: () => ({measureFor: dart.fnType(core.double, [core.Function, core.i
nt])}), | 102 statics: () => ({measureFor: dart.fnType(core.double, [core.Function, core.i
nt])}), |
| 99 names: ['measureFor'] | 103 names: ['measureFor'] |
| 100 }); | 104 }); |
| 101 dart.trackLibraries("BenchmarkBase", { | 105 dart.trackLibraries("BenchmarkBase", { |
| 102 "BenchmarkBase.dart": BenchmarkBase$ | 106 "BenchmarkBase.dart": BenchmarkBase$ |
| 103 }, null); | 107 }, null); |
| 104 // Exports: | 108 // Exports: |
| 105 return { | 109 return { |
| 106 BenchmarkBase: BenchmarkBase$ | 110 BenchmarkBase: BenchmarkBase$ |
| 107 }; | 111 }; |
| 108 }); | 112 }); |
| OLD | NEW |