Fix #816; remove references to valueWindow (#817)
[dygraphs.git] / tests / perf.html
CommitLineData
54425b14 1<!DOCTYPE html>
bb5899c5
DV
2<html>
3 <head>
fd6b8dad 4 <link rel="stylesheet" href="../dist/dygraph.css">
6f091595 5 <title>perf</title>
fbd6834a 6 <script type="text/javascript" src="../dist/dygraph.js"></script>
7e5ddc94 7
bb5899c5
DV
8 <script type="text/javascript" src="data.js"></script>
9 </head>
10 <body>
d16579a0 11 <div id="div_g" style="width:600px; height:300px;"></div>
bb5899c5
DV
12 <div id="status"></div>
13
14 <script type="text/javascript">
4cfcc38c 15 var num_tests = 250;
4b38df10 16 var times = [];
bb5899c5
DV
17 var start = new Date;
18
19 for (var i = 0; i < num_tests; i++) {
4b38df10 20 var this_start = new Date;
4cfcc38c
DV
21 // Calling destroy() here reduces the memory usage in Chrome by
22 // ~1.2MB/instantiation.
23 if (i) g.destroy();
bb5899c5 24 g = new Dygraph(
d16579a0 25 document.getElementById("div_g"),
bb5899c5
DV
26 NoisyData, {
27 rollPeriod: 7,
28 errorBars: true
29 }
30 );
4b38df10
DV
31 var this_end = new Date;
32 times.push([i, this_end - this_start]);
bb5899c5
DV
33 }
34
35 var end = new Date;
36
37 document.getElementById("status").innerHTML = "Elapsed time: " + (end - start)/num_tests + " ms/instantiation";
4cfcc38c 38 perf = new Dygraph(
d16579a0 39 document.getElementById("div_g"),
4b38df10
DV
40 times, {
41 labels: [ "Iteration", "Time (ms)" ]
42 }
43 );
bb5899c5 44 </script>
1ac31d4e 45
ab68ea2d 46 <p><b>Some numbers on a MacBook Pro 2.53 GHz Core 2 Duo</b><br/>
1920a008
RK
47 <table border="1"><tbody>
48 <tr><td>commit</td><td>Firefox 3.0.15</td><td>Safari 4.0.3</td></tr>
49 <tr><td>bb5899c56e33716db724cb60a5120b91f5fccdeb</td>
50 <td>28 ms/instantiation</td>
51 <td>15.02 ms/instantiation</td></tr>
52 <tr><td>2847c1cf1a2874e9fe56b5749e6e105e37bb086a</td>
53 <td>49.27 ms/instantiation</td>
54 <td>24.48 ms/instantiation</td></tr>
55 </tbody></table>
1ac31d4e 56 </p>
bb5899c5
DV
57 </body>
58</html>