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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/observe_test.dart ('k') | test/perf/input/observe_model.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/perf/input/change_1_of_100_test.html
diff --git a/test/perf/input/bindings_10_test.html b/test/perf/input/change_1_of_100_test.html
similarity index 60%
copy from test/perf/input/bindings_10_test.html
copy to test/perf/input/change_1_of_100_test.html
index 6d3f284b46c5655026ead549cceb86eb6355919b..2e966f3c8260c5620866e00883385668c4fa33c7 100644
--- a/test/perf/input/bindings_10_test.html
+++ b/test/perf/input/change_1_of_100_test.html
@@ -7,8 +7,8 @@ BSD-style license that can be found in the LICENSE file.
<html lang="en">
<head>
<!--
- This performance test updates a 10 text binding (depending on the same
- variable) on each iteration.
+ This performance test runs has 100 bindings, which get updated on every
+ iteration of the benchmark.
-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@@ -16,40 +16,40 @@ BSD-style license that can be found in the LICENSE file.
<script type="application/javascript" src="start_dart.js"></script>
</head>
<body>
- <div>
- <span>{{x}}</span>
- <span>{{x}}</span>
- <span>{{x}}</span>
- <span id='test'>{{x}}</span>
- <span>{{x}}</span>
- <span>{{x}}</span>
- <span>{{x}}</span>
- <span>{{x}}</span>
- <span>{{x}}</span>
- <span>{{x}}</span>
- </div>
+ <template iterate="item in items">
+ {{item.x}}
+ </template>
<script type="application/dart">
import 'dart:html';
import 'package:web_ui/web_ui.dart';
import 'package:unittest/unittest.dart';
import 'perf_common.dart';
+import 'observe_model.dart';
main() {
useShadowDom = false;
+ useObservers = true;
window.setTimeout(() {
var bench = new BindingBenchmark();
perfDone(bench.measure());
}, 0);
}
-int x = 0;
+final ObservableList<Model> items = (() {
+ var items = useObservers ? new ObservableList(10000) : new List(10000);
+ for (int i = 0; i < items.length; i++) items[i] = new Model();
+ return items;
+})();
class BindingBenchmark extends BenchmarkBase {
- BindingBenchmark() : super('bind-10');
+ BindingBenchmark() : super('change-1-of-100');
run() {
- x++;
- dispatch();
- expect(query('#test').innerHtml, "$x");
+ items[42].x++;
+ if (useObservers) {
+ deliverChangesSync();
+ } else {
+ dispatch();
+ }
}
}
</script>
« 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