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

Side by Side Diff: samples/third_party/dromaeo/tests/dom-query-html.dart

Issue 9732019: dart:html perf optimization based on runing Dromaeo benchmarks (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Respond to code review comments Created 8 years, 9 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
1 #library("dom_query_html"); 1 #library("dom_query_html");
2 #import("dart:html"); 2 #import("dart:html");
3 #import('../common/common.dart'); 3 #import('../common/common.dart');
4 #source("Common.dart"); 4 #source("Common.dart");
5 #source("RunnerSuite.dart"); 5 #source("RunnerSuite.dart");
6 6
7 void main() { 7 void main() {
8 final int num = 40; 8 final int num = 40;
9 9
10 // Try to force real results. 10 // Try to force real results.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 ret = document.query('#testA'); 43 ret = document.query('#testA');
44 ret = document.query('#testB'); 44 ret = document.query('#testB');
45 ret = document.query('#testC'); 45 ret = document.query('#testC');
46 ret = document.query('#testD'); 46 ret = document.query('#testD');
47 ret = document.query('#testE'); 47 ret = document.query('#testE');
48 ret = document.query('#testF'); 48 ret = document.query('#testF');
49 } 49 }
50 }) 50 })
51 .test('getElementsByTagName(div)', () { 51 .test('getElementsByTagName(div)', () {
52 for (int i = 0; i < num; i++) { 52 for (int i = 0; i < num; i++) {
53 var elems = document.queryAll('div'); 53 ElementList elems = document.queryAll('div');
54 ret = elems.last().hidden; 54 for (int j = 0, len = elems.length; j < len; j++) {
55 ret = elems[j].hidden;
56 }
vsm 2012/03/28 18:00:14 Please drop the loop change. It's too far from th
Jacob 2012/03/28 21:01:31 Done.
55 } 57 }
56 }) 58 })
57 .test('getElementsByTagName(p)', () { 59 .test('getElementsByTagName(p)', () {
58 for (int i = 0; i < num; i++) { 60 for (int i = 0; i < num; i++) {
59 final elems = document.queryAll('p'); 61 ElementList elems = document.queryAll('p');
60 ret = elems.last().hidden; 62 for (int j = 0, len = elems.length; j < len; j++) {
63 ret = elems[j].hidden;
64 }
61 } 65 }
62 }) 66 })
63 .test('getElementsByTagName(a)', () { 67 .test('getElementsByTagName(a)', () {
64 for (int i = 0; i < num; i++) { 68 for (int i = 0; i < num; i++) {
65 var elems = document.queryAll('a'); 69 ElementList elems = document.queryAll('a');
66 ret = elems.last().hidden; 70 for (int j = 0, len = elems.length; j < len; j++) {
71 ret = elems[j].hidden;
72 }
67 } 73 }
68 }) 74 })
69 .test('getElementsByTagName(*)', () { 75 .test('getElementsByTagName(*)', () {
70 for (int i = 0; i < num; i++) { 76 for (int i = 0; i < num; i++) {
71 var elems = document.queryAll('*'); 77 ElementList elems = document.queryAll('*');
72 ret = elems.last().hidden; 78 for (int j = 0, len = elems.length; j < len; j++) {
79 ret = elems[j].hidden;
80 }
73 } 81 }
74 }) 82 })
75 .test('getElementsByTagName (not in document)', () { 83 .test('getElementsByTagName (not in document)', () {
76 for (int i = 0; i < num; i++) { 84 for (int i = 0; i < num; i++) {
77 var elems = document.queryAll('strong'); 85 ElementList elems = document.queryAll('strong');
78 ret = elems.length == 0; 86 for (int j = 0, len = elems.length; j < len; j++) {
87 ret = elems[j].hidden;
88 }
79 } 89 }
80 }) 90 })
81 .test('getElementsByName', () { 91 .test('getElementsByName', () {
82 for (int i = 0; i < num * 20; i++) { 92 for (int i = 0; i < num * 20; i++) {
83 var elems = document.queryAll('[name="test$num"]'); 93 ElementList elems = document.queryAll('[name="test$num"]');
84 ret = elems.last().hidden; 94 ret = elems.last().hidden;
85 elems = document.queryAll('[name="test$num"]'); 95 elems = document.queryAll('[name="test$num"]');
86 ret = elems.last().hidden; 96 ret = elems.last().hidden;
87 elems = document.queryAll('[name="test$num"]'); 97 elems = document.queryAll('[name="test$num"]');
88 ret = elems.last().hidden; 98 ret = elems.last().hidden;
89 elems = document.queryAll('[name="test$num"]'); 99 elems = document.queryAll('[name="test$num"]');
90 ret = elems.last().hidden; 100 ret = elems.last().hidden;
91 } 101 }
92 }) 102 })
93 .test('getElementsByName (not in document)', () { 103 .test('getElementsByName (not in document)', () {
94 for (int i = 0; i < num * 20; i++) { 104 for (int i = 0; i < num * 20; i++) {
95 ret = document.queryAll('[name="test"]').length == 0; 105 ret = document.queryAll('[name="test"]').length == 0;
96 ret = document.queryAll('[name="test"]').length == 0; 106 ret = document.queryAll('[name="test"]').length == 0;
97 ret = document.queryAll('[name="test"]').length == 0; 107 ret = document.queryAll('[name="test"]').length == 0;
98 ret = document.queryAll('[name="test"]').length == 0; 108 ret = document.queryAll('[name="test"]').length == 0;
99 ret = document.queryAll('[name="test"]').length == 0; 109 ret = document.queryAll('[name="test"]').length == 0;
100 } 110 }
101 }) 111 })
102 .end(); 112 .end();
103 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698