Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Side by Side Diff: test/perf/input/change_1_of_100_test.html

Issue 12225039: Support for observable models, fixes #259 (Closed) Base URL: https://github.com/dart-lang/web-ui.git@master
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/observe_test.dart ('k') | test/perf/input/observe_model.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <!-- 2 <!--
3 Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 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 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. 5 BSD-style license that can be found in the LICENSE file.
6 --> 6 -->
7 <html lang="en"> 7 <html lang="en">
8 <head> 8 <head>
9 <!-- 9 <!--
10 This performance test updates a 10 text binding (depending on the same 10 This performance test runs has 100 bindings, which get updated on every
11 variable) on each iteration. 11 iteration of the benchmark.
12 --> 12 -->
13 <meta charset="utf-8"> 13 <meta charset="utf-8">
14 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 14 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
15 <script type="application/javascript" src="testing.js"></script> 15 <script type="application/javascript" src="testing.js"></script>
16 <script type="application/javascript" src="start_dart.js"></script> 16 <script type="application/javascript" src="start_dart.js"></script>
17 </head> 17 </head>
18 <body> 18 <body>
19 <div> 19 <template iterate="item in items">
20 <span>{{x}}</span> 20 {{item.x}}
21 <span>{{x}}</span> 21 </template>
22 <span>{{x}}</span>
23 <span id='test'>{{x}}</span>
24 <span>{{x}}</span>
25 <span>{{x}}</span>
26 <span>{{x}}</span>
27 <span>{{x}}</span>
28 <span>{{x}}</span>
29 <span>{{x}}</span>
30 </div>
31 <script type="application/dart"> 22 <script type="application/dart">
32 import 'dart:html'; 23 import 'dart:html';
33 import 'package:web_ui/web_ui.dart'; 24 import 'package:web_ui/web_ui.dart';
34 import 'package:unittest/unittest.dart'; 25 import 'package:unittest/unittest.dart';
35 import 'perf_common.dart'; 26 import 'perf_common.dart';
27 import 'observe_model.dart';
36 28
37 main() { 29 main() {
38 useShadowDom = false; 30 useShadowDom = false;
31 useObservers = true;
39 window.setTimeout(() { 32 window.setTimeout(() {
40 var bench = new BindingBenchmark(); 33 var bench = new BindingBenchmark();
41 perfDone(bench.measure()); 34 perfDone(bench.measure());
42 }, 0); 35 }, 0);
43 } 36 }
44 37
45 int x = 0; 38 final ObservableList<Model> items = (() {
39 var items = useObservers ? new ObservableList(10000) : new List(10000);
40 for (int i = 0; i < items.length; i++) items[i] = new Model();
41 return items;
42 })();
46 43
47 class BindingBenchmark extends BenchmarkBase { 44 class BindingBenchmark extends BenchmarkBase {
48 BindingBenchmark() : super('bind-10'); 45 BindingBenchmark() : super('change-1-of-100');
49 run() { 46 run() {
50 x++; 47 items[42].x++;
51 dispatch(); 48 if (useObservers) {
52 expect(query('#test').innerHtml, "$x"); 49 deliverChangesSync();
50 } else {
51 dispatch();
52 }
53 } 53 }
54 } 54 }
55 </script> 55 </script>
56 </body> 56 </body>
57 </html> 57 </html>
OLDNEW
« no previous file with comments | « test/observe_test.dart ('k') | test/perf/input/observe_model.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698