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

Side by Side Diff: client/dom/benchmarks/dromaeo/tests/dom-traverse.dart

Issue 9374026: Move dromaeo to third_party (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Moved Dromaeo to third party. Created 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 #library("dom-traverse.dart");
2 #import("dart:dom");
3 #import('../../common/common.dart');
4 #import('runner.dart');
5
6
7 void main() {
8 final int num = 40;
9
10 // Try to force real results.
11 var ret;
12
13 String html = document.body.innerHTML;
14
15 new Suite(window, 'dom-traverse')
16 .prep(() {
17 html = BenchUtil.replaceAll(html, 'id="test(\\w).*?"', (Match match) {
18 final group = match.group(1);
19 return 'id="test${group}${num}"';
20 });
21 html = BenchUtil.replaceAll(html, 'name="test.*?"', (Match match) {
22 return 'name="test${num}"';
23 });
24 html = BenchUtil.replaceAll(html, 'class="foo.*?"', (Match match) {
25 return 'class="foo test${num} bar"';
26 });
27
28 final div = document.createElement('div');
29 div.innerHTML = html;
30 document.body.appendChild(div);
31 })
32 .test('firstChild', () {
33 final nodes = document.body.childNodes;
34 final nl = nodes.length;
35
36 for (int i = 0; i < num; i++) {
37 for (int j = 0; j < nl; j++) {
38 Node cur = nodes[j];
39 while (cur !== null) {
40 cur = cur.firstChild;
41 }
42 ret = cur;
43 }
44 }
45 })
46 .test('lastChild', () {
47 final nodes = document.body.childNodes;
48 final nl = nodes.length;
49
50 for (int i = 0; i < num; i++) {
51 for (int j = 0; j < nl; j++) {
52 Node cur = nodes[j];
53 while (cur !== null) {
54 cur = cur.lastChild;
55 }
56 ret = cur;
57 }
58 }
59 })
60 .test('nextSibling', () {
61 for (int i = 0; i < num * 2; i++) {
62 Node cur = document.body.firstChild;
63 while (cur !== null) {
64 cur = cur.nextSibling;
65 }
66 ret = cur;
67 }
68 })
69 .test('previousSibling', () {
70 for (int i = 0; i < num * 2; i++) {
71 Node cur = document.body.firstChild;
72 while (cur !== null) {
73 cur = cur.previousSibling;
74 }
75 ret = cur;
76 }
77 })
78 .test('childNodes', () {
79 for (int i = 0; i < num; i++) {
80 final nodes = document.body.childNodes;
81 for (int j = 0; j < nodes.length; j++) {
82 ret = nodes[j];
83 }
84 }
85 })
86 .end();
87 }
OLDNEW
« no previous file with comments | « client/dom/benchmarks/dromaeo/tests/dom-query.html ('k') | client/dom/benchmarks/dromaeo/tests/dom-traverse.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698