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