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