| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- |
| 3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 4 for details. All rights reserved. Use of this source code is governed by a |
| 5 BSD-style license that can be found in the LICENSE file. |
| 6 --> |
| 7 <html lang="en"> |
| 8 <head> |
| 9 <!-- |
| 10 This performance test toggles a simple conditional back and forth. |
| 11 --> |
| 12 <meta charset="utf-8"> |
| 13 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 14 <script type="application/javascript" src="testing.js"></script> |
| 15 <script type="application/javascript" src="start_dart.js"></script> |
| 16 </head> |
| 17 <body> |
| 18 <template instantiate="if x % 2 == 0"> |
| 19 <span id='test'>yes</span> |
| 20 </template> |
| 21 <script type="application/dart"> |
| 22 import 'dart:html'; |
| 23 import 'package:web_ui/web_ui.dart'; |
| 24 import 'package:unittest/unittest.dart'; |
| 25 import 'perf_common.dart'; |
| 26 |
| 27 main() { |
| 28 useShadowDom = false; |
| 29 window.setTimeout(() { |
| 30 var bench = new ConditionalBenchmark(); |
| 31 perfDone(bench.measure()); |
| 32 }, 0); |
| 33 } |
| 34 |
| 35 int x = 0; |
| 36 |
| 37 class ConditionalBenchmark extends BenchmarkBase { |
| 38 ConditionalBenchmark() : super('if-1-mod2'); |
| 39 run() { |
| 40 x++; |
| 41 dispatch(); |
| 42 expect(query('#test'), x % 2 == 0 ? isNotNull : isNull); |
| 43 } |
| 44 } |
| 45 </script> |
| 46 </body> |
| 47 </html> |
| OLD | NEW |