r20446: rename swat directory to swat.obsolete; keeping it around since there is...
[samba.git] / swat.obsolete / apps / qooxdoo-examples / performance / LocalObject_2.html
1 <html>
2 <head>
3   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4   <title>qooxdoo &raquo; Demo</title>
5   <link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/>
6   <!--[if IE]>
7   <link type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/>
8   <![endif]-->
9   <script type="text/javascript" src="../../script/qx.js"></script>
10 </head>
11 <body>
12   <script type="text/javascript" src="../../script/layout.js"></script>
13
14   <div id="demoDescription">
15     <p>JS Object Storage Performance</p>
16
17     <h1>Test Description</h1>
18     <p>Precreate 50.000 objects (locally stored). After this create 10.000 new (not stored) objects inside a loop.</p>
19     <p>As the loop will be executed inside the scope of "store", the browser must keep the information about "store" with each execution of "test", even if called from the timeout.</p>
20
21     <h1>Result</h1>
22     <p>The performance in IE is poor (~1150ms for each loop), compared to the same stuff executed without so much precreated objects (previous example).</p>
23     <p>It makes no difference if we use a global or a local variable here. It's identical to GlobalObject_2.html.</p>
24   </div>
25
26   <script type="text/javascript">
27   qx.core.Init.getInstance().defineMain(function()
28   {
29     var store = [];
30
31     for (var i=0; i<50000; i++) {
32       store.push({});
33     };
34
35     function test()
36     {
37       var _s = (new Date).valueOf();
38
39       for (var i=0; i<10000; i++) {
40         new Object()
41       };
42
43       window.status = "time: " + (new Date).valueOf() + " | measured: " + ((new Date).valueOf() - _s) + "ms";
44       window.setTimeout(test, 1000);
45     }
46
47     test();
48   });
49   </script>
50 </body>
51 </html>