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.definiteFunctionType(co
re.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)) { |
(...skipping 14 matching lines...) Expand all Loading... |
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.definiteFunctionType(dart.dynamic, [dart.dynamic
])}), |
28 statics: () => ({ | 28 statics: () => ({ |
29 equals: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])
, | 29 equals: dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic])
, |
30 listEquals: dart.definiteFunctionType(dart.void, [core.List, core.List]) | 30 listEquals: dart.definiteFunctionType(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() { |
| 36 return this[name$]; |
| 37 } |
| 38 set name(value) { |
| 39 super.name = value; |
| 40 } |
35 new(name) { | 41 new(name) { |
36 this.name = name; | 42 this[name$] = name; |
37 } | 43 } |
38 run() {} | 44 run() {} |
39 warmup() { | 45 warmup() { |
40 this.run(); | 46 this.run(); |
41 } | 47 } |
42 exercise() { | 48 exercise() { |
43 for (let i = 0; i < 10; i++) { | 49 for (let i = 0; i < 10; i++) { |
44 this.run(); | 50 this.run(); |
45 } | 51 } |
46 } | 52 } |
(...skipping 21 matching lines...) Expand all Loading... |
68 this.exercise(); | 74 this.exercise(); |
69 }, VoidToNull()), 2000); | 75 }, VoidToNull()), 2000); |
70 this.teardown(); | 76 this.teardown(); |
71 return result; | 77 return result; |
72 } | 78 } |
73 report() { | 79 report() { |
74 let score = this.measure(); | 80 let score = this.measure(); |
75 core.print(dart.str`${this.name}(RunTime): ${score} us.`); | 81 core.print(dart.str`${this.name}(RunTime): ${score} us.`); |
76 } | 82 } |
77 }; | 83 }; |
| 84 const name$ = Symbol("BenchmarkBase.name"); |
78 dart.setSignature(BenchmarkBase$.BenchmarkBase, { | 85 dart.setSignature(BenchmarkBase$.BenchmarkBase, { |
79 fields: () => ({name: core.String}), | 86 fields: () => ({name: core.String}), |
80 methods: () => ({ | 87 methods: () => ({ |
81 run: dart.definiteFunctionType(dart.void, []), | 88 run: dart.definiteFunctionType(dart.void, []), |
82 warmup: dart.definiteFunctionType(dart.void, []), | 89 warmup: dart.definiteFunctionType(dart.void, []), |
83 exercise: dart.definiteFunctionType(dart.void, []), | 90 exercise: dart.definiteFunctionType(dart.void, []), |
84 setup: dart.definiteFunctionType(dart.void, []), | 91 setup: dart.definiteFunctionType(dart.void, []), |
85 teardown: dart.definiteFunctionType(dart.void, []), | 92 teardown: dart.definiteFunctionType(dart.void, []), |
86 measure: dart.definiteFunctionType(core.double, []), | 93 measure: dart.definiteFunctionType(core.double, []), |
87 report: dart.definiteFunctionType(dart.void, []) | 94 report: dart.definiteFunctionType(dart.void, []) |
88 }), | 95 }), |
89 statics: () => ({measureFor: dart.definiteFunctionType(core.double, [core.Fu
nction, core.int])}), | 96 statics: () => ({measureFor: dart.definiteFunctionType(core.double, [core.Fu
nction, core.int])}), |
90 names: ['measureFor'] | 97 names: ['measureFor'] |
91 }); | 98 }); |
92 dart.trackLibraries("BenchmarkBase", {"BenchmarkBase.dart": BenchmarkBase$}, n
ull); | 99 dart.trackLibraries("BenchmarkBase", {"BenchmarkBase.dart": BenchmarkBase$}, n
ull); |
93 // Exports: | 100 // Exports: |
94 return { | 101 return { |
95 BenchmarkBase: BenchmarkBase$ | 102 BenchmarkBase: BenchmarkBase$ |
96 }; | 103 }; |
97 }); | 104 }); |
OLD | NEW |