Chromium Code Reviews| 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 updates a list of 2 elements used in a single loop. | |
|
Jennifer Messerly
2013/01/07 21:07:46
this seems really small, I guess it's intended to
Siggi Cherem (dart-lang)
2013/01/08 02:26:18
yeah - each test is run repeatedly, so this is mea
| |
| 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 iterate="x in list"> | |
| 19 <span>{{x}}</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 LoopBenchmark(); | |
| 31 perfDone(bench.measure()); | |
| 32 }, 0); | |
| 33 } | |
| 34 | |
| 35 const DEFAULT_LIST = const [0, 100]; | |
| 36 | |
| 37 List list = []; | |
| 38 | |
| 39 class LoopBenchmark extends BenchmarkBase { | |
| 40 LoopBenchmark() : super('loop-1-2'); | |
| 41 int pos = 0; | |
| 42 setup() { | |
| 43 list.clear(); | |
| 44 list.addAll(DEFAULT_LIST); | |
| 45 pos = 0; | |
| 46 } | |
| 47 | |
| 48 run() { | |
| 49 list[pos] += 1; | |
| 50 pos = (pos + 1) % DEFAULT_LIST.length; | |
| 51 dispatch(); | |
| 52 } | |
| 53 } | |
| 54 </script> | |
| 55 </body> | |
| 56 </html> | |
| OLD | NEW |