1 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="400" height="400">
2 <script type="text/javascript">
3 var start = new Date();
5 <text x="10" y="15" font-weight="900" font-size="5">SVG Performance test.</text>
6 <text x="10" y="95" font-weight="900" font-size="5">Test not started.</text>
7 <rect x="0" y="0" height="100" width="100" stroke="black" fill="none"/>
8 <script type="text/javascript"><![CDATA[
9 var svg = document.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'svg')[0];
10 var t = document.getElementsByTagNameNS('http://www.w3.org/2000/svg', 'text')[1];
12 var Xs = new Array(9, 65, 92, 30, 92, 40, 65, 47, 79, 10, 77, 45,
13 27, 13, 43, 52, 55, 46, 1, 24, 42, 11, 15, 18, 42, 49, 50, 30, 69,
14 95, 36, 49, 46, 85, 54, 26, 15, 56, 18, 92, 40, 41, 66, 85, 7, 47,
15 66, 13, 72, 29, 48, 57, 61, 46, 70, 3, 62, 34, 74, 13, 32, 20, 8,
16 2, 60, 97, 58, 1, 0, 89, 85, 48, 52, 98, 12, 26, 5, 5, 48, 19, 22,
17 34, 83, 13, 65, 77, 23, 40, 56, 65, 13, 54, 81, 10, 53, 25, 93,
20 var Ys = new Array(42, 80, 93, 30, 54, 33, 76, 56, 2, 79, 37, 80,
21 80, 19, 99, 31, 89, 22, 23, 42, 27, 81, 26, 19, 80, 6, 62, 67, 73,
22 18, 69, 10, 42, 88, 100, 99, 47, 88, 26, 46, 49, 60, 7, 10, 48, 29,
23 25, 26, 33, 73, 84, 24, 42, 74, 5, 49, 69, 81, 19.5, 67, 10, 53, 79,
24 56, 32, 98, 78, 7, 3, 68, 12, 80, 42, 24, 82, 69, 9, 43, 47, 19,
25 69, 45, 41, 64, 1, 39, 25, 84, 35, 77, 26, 43, 32, 75, 89, 66, 48,
28 var Ss = new Array(5, 3, 1, 3, 1, 8, 8, 7, 8, 5, 1, 4, 4, 2, 1, 2,
29 2, 6, 4, 3, 1, 5, 1, 2, 6, 1, 5, 7, 3, 6, 6, 4, 7, 2, 5, 3, 5, 3,
30 5, 2, 8, 1, 2, 1, 6, 4, 3, 2, 4, 8, 3, 5, 8, 8, 2, 2, 2, 8, 5, 6,
31 4, 8, 5, 3, 6, 2, 3, 2, 3, 6, 3, 5, 8, 7, 2, 4, 8, 8, 6, 4, 6, 1,
32 8, 6, 7, 4, 7, 8, 3, 7, 7, 8, 4, 2, 2, 8, 2, 8, 7, 3);
34 var Rs = new Array(157, 142, 37, 13, 349, 83, 158, 214, 34, 353,
35 196, 29, 296, 225, 124, 355, 68, 305, 315, 190, 146, 274, 167,
36 132, 298, 272, 266, 265, 28, 213, 99, 260, 323, 233, 111, 270,
37 165, 177, 58, 350, 322, 137, 163, 80, 206, 138, 20, 355, 32, 310,
38 309, 260, 153, 309, 151, 189, 52, 170, 326, 157, 65, 41, 28, 92,
39 96, 196, 250, 313, 125, 226, 63, 245, 158, 196, 7, 169, 96, 224,
40 222, 273, 37, 26, 331, 302, 57, 55, 171, 347, 319, 54, 83, 189,
41 281, 79, 75, 138, 223, 138, 238, 69);
45 var maxPerBlock = Xs.length / (idealTime / delay);
46 var maxBlocks = Xs.length / maxPerBlock;
50 for (var subcount = 0; subcount < maxPerBlock; subcount += 1) {
51 var index = count * maxPerBlock + subcount;
52 var newI = document.createElementNS('http://www.w3.org/2000/svg', 'image');
53 newI.setAttribute('x', Xs[index] - (99 / Ss[index]) / 2);
54 newI.setAttribute('y', Ys[index] - (195 / Ss[index]) / 2);
55 newI.setAttribute('height', 195 / Ss[index]);
56 newI.setAttribute('width', 99 / Ss[index]);
57 newI.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '/resources/images/smallcats');
58 newI.setAttribute('transform', 'translate(50, 50) rotate(' + Rs[index] + ') translate(-50, -50)');
59 newI.appendChild(document.createTextNode(index)); // 'TEST'));
60 svg.insertBefore(newI, t);
63 if (count < maxBlocks) {
64 window.setTimeout(runTest, delay);
65 t.firstChild.data = 'Test in progress... ' + count + ' of ' + maxBlocks;
68 var elapsed = (end - start) / 1000;
69 t.firstChild.data = 'Test completed in ' + elapsed.toFixed(2) + 's.';
70 if (window.tpRecordTime) window.tpRecordTime(end - start);
71 if (parent.reportResults) parent.reportResults(end - start);
74 window.setTimeout(runTest, delay);