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