bench.html
8.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<!DOCTYPE html>
<html>
<head>
<title>Parser scan() Performance Test</title>
<style type="text/css">
@import "../../resources/dojo.css";
</style>
<script type="text/javascript" src="../../dojo.js" data-dojo-config="async:true"></script>
<script type="text/javascript">
require([
"dojo/_base/declare",
"dojo/dom",
"dojo/dom-construct",
"dojo/_base/lang",
"dojo/parser",
"dojo/query",
"doh",
"dojo/domReady!"
], function(declare, dom, domConstruct, lang, parser, query, doh){
declare("TabContainer", null, {
numberProp1: 1,
numberProp2: 2,
booleanProp1: false,
booleanProp2: true,
strProp1: "original1",
strProp2: "original2",
funcProp: function(){}
});
declare("ContentPane", null, {
stopParser: true,
numberProp1: 1,
numberProp2: 2,
booleanProp1: false,
booleanProp2: true,
strProp1: "original1",
strProp2: "original2",
funcProp: function(){}
});
declare("TextBox", null, {
numberProp1: 1,
numberProp2: 2,
booleanProp1: false,
booleanProp2: true,
strProp1: "original1",
strProp2: "original2",
funcProp: function(){}
});
function generateDom(/*String[]*/ nodes, /*Number*/ fan, /*DOMNode*/ parent){
// summary:
// Generate large DOM tree based on nodes in nodes[] array, with fan nodes at each level
var markup = nodes.shift();
for(var i=0; i<fan; i++){
var child = domConstruct.place(markup, parent);
if(nodes.length){
generateDom([].concat(nodes), fan, child); // concat() to clone array
}
}
}
doh.register("parser performance tests", [
// Test scan of DOM without any widgets
{
name: "scan() with no widgets",
testType: "perf",
trialIterations: 20,
setUp: function(){
dom.byId("status").innerHTML = "Running scan() with no widgets test...";
var rows = query("tr", "tbody");
for(var i=0; i<55; i++){
domConstruct.place(rows[i%2 + 1].cloneNode(true), "tbody");
}
},
tearDown: function(){
domConstruct.empty("scan");
},
runTest: function(){
parser._clearCache();
parser.parse("scan");
}
},
{
name: "scan() with lots of widgets",
testType: "perf",
trialIterations: 20,
setUp: function(){
dom.byId("status").innerHTML = "Running scan() with lots of widgets test...";
generateDom([
"<div data-dojo-type=TabContainer></div>",
"<div data-dojo-type=TabContainer></div>",
"<div></div>",
"<input data-dojo-type=TextBox strProp1=name/>"
], 4, "scan");
},
tearDown: function(){
domConstruct.empty("scan");
},
runTest: function(){
parser._clearCache();
parser.parse("scan");
}
},
{
name: "scan() with lots of widgets but _stopParser",
testType: "perf",
trialIterations: 20,
setUp: function(){
dom.byId("status").innerHTML = "Running scan() with lots of widgets and _stopParser test...";
generateDom([
"<div data-dojo-type=TabContainer></div>",
"<div data-dojo-type=ContentPane></div>",
"<div></div>",
"<input data-dojo-type=TextBox strProp1=name/>"
], 4, "scan");
},
tearDown: function(){
domConstruct.empty("scan");
},
runTest: function(){
parser._clearCache();
parser.parse("scan");
}
},
{
name: "instantiate()",
testType: "perf",
trialIterations: 20,
setUp: function(){
dom.byId("status").innerHTML = "Running instantiate() test...";
nodes = [];
for(var i=0; i<100; i++){
nodes.push(domConstruct.place("<input data-dojo-type=TextBox numberProp1=1 numberProp2=2 stringProp1=hi booleanProp1=true funcProp='console.log(12345);'/>", "instantiate"));
}
},
tearDown: function(){
domConstruct.empty("instantiate");
},
runTest: function(){
parser._clearCache();
parser.instantiate(nodes);
}
},
function results(){
dom.byId("status").innerHTML = "Graphing results...";
}
]);
doh.run();
});
</script>
</head>
<body>
<h1>Parser Performance Test</h1>
<!-- Display progress messages so test doesn't seem hung -->
<h2 id="status"></h2>
<!-- Test results are displayed here -->
<div id="perfTestsBody"></div>
<!-- for generating markup to scan (no widgets, just nodes) -->
<div id="scan" style="display: none">
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="datatable" id="reportTable">
<tbody id="tbody">
<tr class="hr">
<td width="1px" style="display: none;">
<input type="checkbox" onclick="" name="cbSelectItem" ignore="true">
</td>
<td class="left">
<span id="_0">
Name
</span>
</td>
<td class="left">
<span id="_1">
RIC
</span>
</td>
<td class="right">
<span id="_2">
PE
</span>
</td>
<td class="right">
Est. PE
</td>
<td class="right">
<span id="_4">
EPS
</span>
</td>
<td class="normaltext left">
Ccy
</td>
<td class="right">
<span id="_6">
DPS
</span>
</td>
<td class="normaltext left">
Ccy
</td>
<td class="right">
<span id="_8">
Div. Yld (%)
</span>
</td>
<td class="right">
<span id="_9">
ROE (%)
</span>
</td>
<td class="right">
<span id="_10">
P/Book
</span>
</td>
<td class="right">
<span id="_11">
P/Sales
</span>
</td>
<td class="normaltext right">
Weight %
</td>
<td class="right">
<span id="_12">
Market Cap (USD)
</span>
</td>
</tr>
<tr headrow="true" class="dr row-o">
<td width="1px" style="display: none;">
<input type="checkbox" value="IBM.N" name="cbSelectItem" ignore="">
</td>
<td class="normaltext left">
International Business Machines Corp
</td>
<td class="normaltext left"><span style="">
<a href="#" class="CCFDATA CCF.Entity[COMP]:RIC=RIC">
RIC
</a>
</span><span style="visibility: hidden; display: none;">-</span></td>
<td class="normaltext right">xx,xx</td>
<td class="normaltext right">xx,xx</td>
<td class="normaltext right">x,xx</td>
<td class="normaltext left nowrap">XXX</td>
<td class="normaltext right">xx.xx,xx</td>
<td class="normaltext left nowrap">XXX</td>
<td class="normaltext right">x,xx</td>
<td class="normaltext right">xx,xx</td>
<td class="normaltext right">x,xx</td>
<td class="normaltext right">x,xx</td>
<td class="normaltext right">-</td>
<td class="normaltext right">xxx,xxx</td>
</tr>
<tr headrow="true" class="dr row-e">
<td width="1px" style="display: none;">
<input type="checkbox" value=" " name="cbSelectItem" ignore="true">
</td>
<td class="normaltext left">
Index average (Mean)</td>
<td class="normaltext left"><span style="visibility: hidden; display: none;">
<a href="/Explorer/Default.aspx?s=%26nbsp&amp;st=RIC" class="CCFDATA CCF.Entity[COMP]:RIC=&nbsp">
</a>
</span><span style="">-</span></td>
<td class="normaltext right">xx,xx</td>
<td class="normaltext right">xx,xx</td>
<td class="normaltext right">n/a</td>
<td class="normaltext left nowrap">n/a</td>
<td class="normaltext right">n/a</td>
<td class="normaltext left nowrap">n/a</td>
<td class="normaltext right">xx,xx</td>
<td class="normaltext right">xx,xx</td>
<td class="normaltext right">x,xx</td>
<td class="normaltext right">x,xx</td>
<td class="normaltext right">-</td>
<td class="normaltext right">xx,xxx</td>
</tr>
</tbody>
</table>
</div>
<!-- for testing widget instantiation speed -->
<div id="instantiate" style="display: none"></div>
</body>
</html>