OLD | NEW |
| (Empty) |
1 library angular.perf.try_catch; | |
2 | |
3 import '_perf.dart'; | |
4 | |
5 /** | |
6 * Compare with JS: http://jsperf.com/throw-new-error-vs-throw-name-error | |
7 * | |
8 * JavaScript vs Dart times on same machine: | |
9 * | |
10 * JavaScript Dart | |
11 * try-catch no stack: 4,952,173 3,944,303 ops/sec | |
12 * try-catch with stack: 111,815 840,843 ops/sec | |
13 * try-catch read stack: 9,206 9,356 ops/sec | |
14 */ | |
15 main() { | |
16 var obj = {}; | |
17 time('try-catch no stack', () { | |
18 try { throw obj; } catch(e) { return e; } | |
19 } ); | |
20 time('try-catch with stack', () { | |
21 try { throw obj; } catch(e, s) { return s; } | |
22 } ); | |
23 time('try-catch read stack', () { | |
24 try { throw obj; } catch(e, s) { return '$s'; } | |
25 } ); | |
26 } | |
OLD | NEW |