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

Side by Side Diff: lib/html/benchmarks/dromaeo/tests/DomTraverse.dart

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

Powered by Google App Engine
This is Rietveld 408576698