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