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

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

Issue 11683002: Setting up benchmarks and perf utilities (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: john comments Created 7 years, 11 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/perf/input/todomvc3_test.html ('k') | test/perf/input/todomvc_common.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 test runs the TodoMVC app, adds a few elements, marks some as done, and 10 This performance test runs the TodoMVC app and uses the application as follows:
11 switches from back and forth between "Active" and "All". This will make some 11 * on each iteration:
12 nodes to be hidden and readded to the page. 12 * clear all todos
13 * add 5 todos
14 * mark 1 as done
15 * clear the todo marked as done.
13 16
14 This is a regression test for a bug in dwc that made the nodes appear in the 17 This test is just like todomvc_test.html, but we use requestLayoutFrame
15 wrong order when using lists and ifs together. 18 between rendering steps (after adding each note, or removing a note).
16 --> 19 -->
17 <meta charset="utf-8"> 20 <meta charset="utf-8">
18 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 21 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
19 <link rel="components" href="example/todomvc/router_options.html"> 22 <link rel="components" href="example/todomvc/router_options.html">
20 <link rel="components" href="example/todomvc/todo_row.html"> 23 <link rel="components" href="example/todomvc/todo_row.html">
21 <link rel="stylesheet" href="example/todomvc/base.css"> 24 <link rel="stylesheet" href="example/todomvc/base.css">
22 <script type="application/javascript" src="testing.js"></script> 25 <script type="application/javascript" src="testing.js"></script>
26 <script type="application/javascript" src="start_dart.js"></script>
23 <title>dart - TodoMVC</title> 27 <title>dart - TodoMVC</title>
24 </head> 28 </head>
25 <body> 29 <body>
26 <section id="todoapp"> 30 <section id="todoapp">
27 <header id="header"> 31 <header id="header">
28 <h1 class='title'>todos</h1> 32 <h1 class='title'>todos</h1>
29 <form on-submit="addTodo($event)"> 33 <form on-submit="addTodo($event)">
30 <input id="new-todo" placeholder="What needs to be done?" autofocus 34 <input id="new-todo" placeholder="What needs to be done?" autofocus
31 on-change="addTodo($event)"> 35 on-change="addTodo($event)">
32 </form> 36 </form>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 <a href="https://github.com/dart-lang/web-ui/tree/master/example/todomvc"> view the source</a>. 72 <a href="https://github.com/dart-lang/web-ui/tree/master/example/todomvc"> view the source</a>.
69 </p> 73 </p>
70 <p>Part of <a href="http://todomvc.com">TodoMVC</a>.</p> 74 <p>Part of <a href="http://todomvc.com">TodoMVC</a>.</p>
71 </footer> 75 </footer>
72 <script type="application/dart"> 76 <script type="application/dart">
73 import 'dart:html'; 77 import 'dart:html';
74 import 'package:unittest/unittest.dart'; 78 import 'package:unittest/unittest.dart';
75 import 'package:web_ui/web_ui.dart'; 79 import 'package:web_ui/web_ui.dart';
76 import 'example/todomvc/main.dart' as todomvc_main; 80 import 'example/todomvc/main.dart' as todomvc_main;
77 import 'example/todomvc/model.dart'; 81 import 'example/todomvc/model.dart';
82 import 'perf_common.dart';
83 import 'todomvc_common.dart';
78 84
79 final addTodo = todomvc_main.addTodo; 85 final addTodo = todomvc_main.addTodo;
80 86
81 main() { 87 main() {
82 useShadowDom = true; 88 useShadowDom = false;
83 todomvc_main.main(); 89 todomvc_main.main();
90 window.setTimeout(() {
91 var bench = new TodoMvcBenchmark();
92 bench.measure().transform(perfDone);
93 }, 0);
94 }
84 95
85 window.setTimeout(() { 96 class TodoMvcBenchmark extends AsyncBenchmark {
86 app.todos.add(new Todo('one (unchecked)')); 97 TodoMvcBenchmark() : super('todomvc-async');
87 app.todos.add(new Todo('two (checked)')..done = true); 98 Future run() {
88 app.todos.add(new Todo('three (unchecked)')); 99 return asyncSteps([
89 viewModel.showIncomplete = true; 100 app.todos.clear,
90 viewModel.showDone = true; 101 () => addNote("one"),
102 () => addNote("two"),
103 () => addNote("three"),
104 () => addNote("four"),
105 () => addNote("five"),
106 () => markChecked(3)]);
107 }
108 }
109
110 Future step(f) {
111 var completer = new Completer();
112 window.requestLayoutFrame(() {
113 var res = f();
91 dispatch(); 114 dispatch();
115 completer.complete(res);
116 });
117 return completer.future;
118 }
92 119
93 window.setTimeout(() { 120 Future asyncSteps(List<Function> steps) {
94 viewModel.showIncomplete = true; 121 Future result = step(steps[0]);
95 viewModel.showDone = false; 122 for (int i = 1; i < steps.length; i++) {
96 dispatch(); 123 result = result.chain((_) => step(steps[i]));
97 window.setTimeout(() { 124 }
98 viewModel.showIncomplete = true; 125 return result;
99 viewModel.showDone = true; 126
100 dispatch();
101 window.setTimeout(() => window.postMessage('done', '*'), 0);
102 }, 0);
103 }, 0);
104 }, 0);
105 } 127 }
106 </script> 128 </script>
107 </body> 129 </body>
108 </html> 130 </html>
OLDNEW
« no previous file with comments | « test/perf/input/todomvc3_test.html ('k') | test/perf/input/todomvc_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698