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