| 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 VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); | 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)) { |
| 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 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 dart.dcall(f); | 56 dart.dcall(f); |
| 57 elapsed = watch.elapsedMilliseconds; | 57 elapsed = watch.elapsedMilliseconds; |
| 58 iter++; | 58 iter++; |
| 59 } | 59 } |
| 60 return 1000.0 * dart.notNull(elapsed) / iter; | 60 return 1000.0 * dart.notNull(elapsed) / iter; |
| 61 } | 61 } |
| 62 measure() { | 62 measure() { |
| 63 this.setup(); | 63 this.setup(); |
| 64 BenchmarkBase$.BenchmarkBase.measureFor(dart.fn(() => { | 64 BenchmarkBase$.BenchmarkBase.measureFor(dart.fn(() => { |
| 65 this.warmup(); | 65 this.warmup(); |
| 66 }, VoidTodynamic()), 100); | 66 }, VoidToNull()), 100); |
| 67 let result = BenchmarkBase$.BenchmarkBase.measureFor(dart.fn(() => { | 67 let result = BenchmarkBase$.BenchmarkBase.measureFor(dart.fn(() => { |
| 68 this.exercise(); | 68 this.exercise(); |
| 69 }, VoidTodynamic()), 2000); | 69 }, VoidToNull()), 2000); |
| 70 this.teardown(); | 70 this.teardown(); |
| 71 return result; | 71 return result; |
| 72 } | 72 } |
| 73 report() { | 73 report() { |
| 74 let score = this.measure(); | 74 let score = this.measure(); |
| 75 core.print(dart.str`${this.name}(RunTime): ${score} us.`); | 75 core.print(dart.str`${this.name}(RunTime): ${score} us.`); |
| 76 } | 76 } |
| 77 }; | 77 }; |
| 78 dart.setSignature(BenchmarkBase$.BenchmarkBase, { | 78 dart.setSignature(BenchmarkBase$.BenchmarkBase, { |
| 79 constructors: () => ({new: dart.definiteFunctionType(BenchmarkBase$.Benchmar
kBase, [core.String])}), | 79 constructors: () => ({new: dart.definiteFunctionType(BenchmarkBase$.Benchmar
kBase, [core.String])}), |
| 80 fields: () => ({name: core.String}), | 80 fields: () => ({name: core.String}), |
| 81 methods: () => ({ | 81 methods: () => ({ |
| 82 run: dart.definiteFunctionType(dart.void, []), | 82 run: dart.definiteFunctionType(dart.void, []), |
| 83 warmup: dart.definiteFunctionType(dart.void, []), | 83 warmup: dart.definiteFunctionType(dart.void, []), |
| 84 exercise: dart.definiteFunctionType(dart.void, []), | 84 exercise: dart.definiteFunctionType(dart.void, []), |
| 85 setup: dart.definiteFunctionType(dart.void, []), | 85 setup: dart.definiteFunctionType(dart.void, []), |
| 86 teardown: dart.definiteFunctionType(dart.void, []), | 86 teardown: dart.definiteFunctionType(dart.void, []), |
| 87 measure: dart.definiteFunctionType(core.double, []), | 87 measure: dart.definiteFunctionType(core.double, []), |
| 88 report: dart.definiteFunctionType(dart.void, []) | 88 report: dart.definiteFunctionType(dart.void, []) |
| 89 }), | 89 }), |
| 90 statics: () => ({measureFor: dart.definiteFunctionType(core.double, [core.Fu
nction, core.int])}), | 90 statics: () => ({measureFor: dart.definiteFunctionType(core.double, [core.Fu
nction, core.int])}), |
| 91 names: ['measureFor'] | 91 names: ['measureFor'] |
| 92 }); | 92 }); |
| 93 // Exports: | 93 // Exports: |
| 94 return { | 94 return { |
| 95 BenchmarkBase: BenchmarkBase$ | 95 BenchmarkBase: BenchmarkBase$ |
| 96 }; | 96 }; |
| 97 }); | 97 }); |
| OLD | NEW |