Merge branch 'master' of https://github.com/kberg/dygraphs
[dygraphs.git] / tests / perf.html
CommitLineData
54425b14 1<!DOCTYPE html>
bb5899c5
DV
2<html>
3 <head>
10494b48 4 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
6f091595 5 <title>perf</title>
bb5899c5 6 <!--[if IE]>
a2b2c3a1 7 <script type="text/javascript" src="../excanvas.js"></script>
bb5899c5 8 <![endif]-->
d37dca40
DV
9 <script type="text/javascript" src="../strftime/strftime-min.js"></script>
10 <script type="text/javascript" src="../rgbcolor/rgbcolor.js"></script>
bb5899c5
DV
11 <script type="text/javascript" src="../dygraph-canvas.js"></script>
12 <script type="text/javascript" src="../dygraph.js"></script>
13 <script type="text/javascript" src="data.js"></script>
14 </head>
15 <body>
d16579a0 16 <div id="div_g" style="width:600px; height:300px;"></div>
bb5899c5
DV
17 <div id="status"></div>
18
19 <script type="text/javascript">
4cfcc38c 20 var num_tests = 250;
4b38df10 21 var times = [];
bb5899c5
DV
22 var start = new Date;
23
24 for (var i = 0; i < num_tests; i++) {
4b38df10 25 var this_start = new Date;
4cfcc38c
DV
26 // Calling destroy() here reduces the memory usage in Chrome by
27 // ~1.2MB/instantiation.
28 if (i) g.destroy();
bb5899c5 29 g = new Dygraph(
d16579a0 30 document.getElementById("div_g"),
bb5899c5
DV
31 NoisyData, {
32 rollPeriod: 7,
33 errorBars: true
34 }
35 );
4b38df10
DV
36 var this_end = new Date;
37 times.push([i, this_end - this_start]);
bb5899c5
DV
38 }
39
40 var end = new Date;
41
42 document.getElementById("status").innerHTML = "Elapsed time: " + (end - start)/num_tests + " ms/instantiation";
4cfcc38c 43 perf = new Dygraph(
d16579a0 44 document.getElementById("div_g"),
4b38df10
DV
45 times, {
46 labels: [ "Iteration", "Time (ms)" ]
47 }
48 );
bb5899c5 49 </script>
1ac31d4e 50
ab68ea2d 51 <p><b>Some numbers on a MacBook Pro 2.53 GHz Core 2 Duo</b><br/>
1920a008
RK
52 <table border="1"><tbody>
53 <tr><td>commit</td><td>Firefox 3.0.15</td><td>Safari 4.0.3</td></tr>
54 <tr><td>bb5899c56e33716db724cb60a5120b91f5fccdeb</td>
55 <td>28 ms/instantiation</td>
56 <td>15.02 ms/instantiation</td></tr>
57 <tr><td>2847c1cf1a2874e9fe56b5749e6e105e37bb086a</td>
58 <td>49.27 ms/instantiation</td>
59 <td>24.48 ms/instantiation</td></tr>
60 </tbody></table>
1ac31d4e 61 </p>
bb5899c5
DV
62 </body>
63</html>