Changeset 8688

Show
Ignore:
Timestamp:
05/22/07 03:20:36 (20 months ago)
Author:
alex
Message:

profiling page cleanup to enable better testing. Refs #3092

Location:
dijit/trunk/bench
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/bench/create_widgets.html

    r8501 r8688  
    22        "http://www.w3.org/TR/html4/strict.dtd"> 
    33<html> 
    4         <head> 
     4        <head> 
    55                <title>PROGRAMMATIC - Dojo Widget Creation Test</title> 
    6         <script type="text/javascript" src="../../dojo/dojo.js" XdjConfig='isDebug: true, debugAtAllCosts: true'></script> 
    7         <script type="text/javascript"> 
    8                 var queryCount = location.search.match(/count=(\d*)/); 
    9                 var count = (queryCount ? parseInt(queryCount[1]) : 100); 
    10                 var queryClass = location.search.match(/class=([a-zA-z.]*)/); 
    11                 var className = (queryClass ? queryClass[1] : "form.Button"); 
     6                <script type="text/javascript" src="../../dojo/dojo.js"></script> 
     7                <script type="text/javascript" src="../dijit.js"></script> 
     8                <script type="text/javascript"> 
     9                        var queryCount = location.search.match(/count=(\d*)/); 
     10                        var count = (queryCount ? parseInt(queryCount[1]) : 100); 
     11                        var queryClass = location.search.match(/class=([a-zA-z.]*)/); 
     12                        var className = (queryClass ? queryClass[1] : "form.Button"); 
    1213 
    13                 dojo.registerModulePath("dijit", "../dijit"); 
    14                 dojo.require("dijit." + className); 
    15                 dojo.require("dijit.util.parser"); 
    16                 logMessage = window.alert; 
    17         </script> 
     14                        dojo.require("dijit." + className); 
     15                        dojo.require("dijit.util.parser"); 
     16                        logMessage = window.alert; 
     17                </script> 
     18                <style type="text/css"> 
     19                        @import "../themes/tundra/tundra.css"; 
     20                        /* group multiple buttons in a row */ 
     21                        .box { 
     22                                display: block; 
     23                                text-align: center; 
     24                        } 
     25                        .box .dojoButton { 
     26                                width: 80px; 
     27                                margin-right: 10px; 
     28                        } 
     29                        .dojoButtonContents { 
     30                                font-size: 1.6em; 
     31                        } 
    1832 
    19 <style> 
    20          
    21         @import "../themes/tundra/tundra.css"; 
     33                        #buttonContainer { 
     34                                border: 1px solid black; 
     35                                width: 100%; 
     36                        } 
    2237 
    23         /* group multiple buttons in a row */ 
    24         .box { 
    25                 display: block; 
    26                 text-align: center; 
    27         } 
    28         .box .dojoButton { 
    29                 width:80px; 
    30                 margin-right: 10px; 
    31         } 
    32         .dojoButtonContents { 
    33                 font-size: 1.6em; 
    34         } 
     38                        #results { 
     39                                color: darkred; 
     40                        } 
     41                </style> 
     42        </head> 
     43        <body class=tundra> 
     44                <script language='javascript'> 
     45                        document.write("<h2>Currently Creating "+count+" "+className+" instances</h2>"); 
     46                </script> 
     47                Pass <code>?count=<i><b>100</b></i></code> in the query string to change the number of widgets.<br> 
     48                Pass <code>?class=<i><b>form.Button</b></i></code> in the query string to change the widget class. 
     49                <h3 id="results"></h3> 
    3550 
    36         #buttonContainer { 
    37                 border:1px solid black; 
    38                 width:100%; 
    39         } 
    40  
    41         #results { 
    42                 color:darkred; 
    43         } 
    44  
    45 </style> 
    46         </head> 
    47 <body class=tundra> 
    48 <script language='javascript'> 
    49         document.write("<h2>Currently Creating "+count+" "+className+" instances</h2>"); 
    50  
    51 </script> 
    52 Pass <code>?count=<i><b>100</b></i></code> in the query string to change the number of widgets.<br> 
    53 Pass <code>?class=<i><b>form.Button</b></i></code> in the query string to change the widget class. 
    54 <h3 id="results"></h3> 
    55  
    56 <div id="buttonContainer" class='box'></div> 
    57  
    58 <br> 
    59  
    60 <script type="text/javascript"> 
    61 // See if we can make a widget in script and attach it to the DOM ourselves. 
    62  
    63 function makeEm() { 
    64         var constructor = dojo.getObject("dijit."+className); 
    65         var container = dojo.byId("buttonContainer"); 
    66         var t0 = new Date().getTime(); 
    67         for (var i = 1; i <= count; i++) { 
    68                 var it =  
    69                         new constructor( 
    70                                         {caption:"Button "+i, onclick:'logMessage("clicked simple")'} 
    71                                 ); 
    72                 container.appendChild(it.domNode); 
    73                 it.domNode.style.display = ''; 
    74         } 
    75         var t1 = new Date().getTime(); 
    76         dojo.byId("results").innerHTML = "It took " + (t1 - t0) + " msec to create " + count + " "+className+" instances programmatically."; 
    77 } 
    78 dojo.addOnLoad(makeEm); 
    79  
    80  
    81 </script> 
    82  
    83 </body> 
     51                <div id="buttonContainer" class='box'></div> 
     52                <br> 
     53                <script type="text/javascript"> 
     54                        // See if we can make a widget in script and attach it to the DOM ourselves. 
     55                        var constructor = dojo.getObject("dijit."+className); 
     56                        function makeEm(){ 
     57                                var container = dojo.byId("buttonContainer"); 
     58                                var t0 = new Date().getTime(); 
     59                                for (var i = 1; i <= count; i++) { 
     60                                        var it =  
     61                                                new constructor( 
     62                                                                {caption:"Button "+i, onclick:'logMessage("clicked simple")'} 
     63                                                        ); 
     64                                        container.appendChild(it.domNode); 
     65                                        it.domNode.style.display = ''; 
     66                                } 
     67                                var t1 = new Date().getTime(); 
     68                                dojo.byId("results").innerHTML = "It took " + (t1 - t0) + " msec to create " + count + " "+className+" instances programmatically."; 
     69                        } 
     70                        dojo.addOnLoad(makeEm); 
     71                </script> 
     72        </body> 
    8473</html> 
  • dijit/trunk/bench/parse_widgets.php

    r8499 r8688  
    33 
    44<html> 
    5         <head> 
     5        <head> 
    66                <title>PARSE - Dojo Widget Instantiation Test</title> 
    7         <script type="text/javascript" src="../../dojo/dojo.js" XdjConfig='isDebug: true, debugAtAllCosts: true'></script> 
     7                <script type="text/javascript" src="../../dojo/dojo.js"></script> 
     8                <script type="text/javascript" src="../dijit.js"></script> 
     9                <script type="text/javascript"> 
     10                        <? 
     11                                $count                  = (array_key_exists('count', $_GET)   ? $_GET['count'] : 100); 
     12                                $className      = (array_key_exists('class', $_GET)   ? $_GET['class'] : 'form.Button'); 
     13                                 
     14                                echo    "dojo.require('dijit.$className');"; 
     15                                echo    "var count = $count;"; 
     16                                echo    "var className = '$className';"; 
     17                        ?> 
    818 
    9         <script type="text/javascript"> 
    10                 dojo.registerModulePath("dijit", "../dijit"); 
     19                        // start the timer right before the parser is loaded 
     20                        dojo._loaders.unshift(function(){ 
     21                                // start the timer 
     22                                t0 = new Date().getTime(); 
     23                        }); 
     24                        dojo.require("dijit.util.parser"); 
     25                        // this should end the timer right AFTER the parser finishes 
     26                        dojo.addOnLoad( 
     27                                function(){ 
     28                                        var t1 = new Date().getTime(); 
     29                                        dojo.byId("results").innerHTML = "It took " + (t1 - t0) + " msec to parse (and create) " + count + " " + className + " instances."; 
     30                                } 
     31                        ); 
     32                        logMessage = window.alert; 
     33                </script> 
    1134 
    12 <script language="php"> 
    13         $count                  = (array_key_exists('count', $_GET)   ? $_GET['count'] : 100); 
    14         $className      = (array_key_exists('class', $_GET)   ? $_GET['class'] : 'form.Button'); 
    15          
    16         echo    "dojo.require('dijit.$className');"; 
    17         echo    "var count = $count;"; 
    18         echo    "var className = '$className';"; 
    19 </script> 
     35                <style type="text/css"> 
     36                         
     37                        @import "../themes/tundra/tundra.css"; 
    2038 
    21                 // start the timer right before the parser is loaded 
    22                 dojo.addOnLoad( 
    23                         function(){ 
    24                                 // start the timer 
    25                                 window.t0 = new Date().getTime(); 
     39                        #widgetContainer { 
     40                                border:1px solid black; 
     41                                width:100%; 
    2642                        } 
    27                 ); 
    28                 dojo.require("dijit.util.parser"); 
    29                 // this should end the timer right AFTER the parser finishes 
    30                 dojo.addOnLoad( 
    31                         function(){ 
    32                                 window.t1 = new Date().getTime(); 
    33                                 dojo.byId("results").innerHTML = "It took " + (t1 - t0) + " msec to parse (and create) " + count + " " + className + " instances."; 
     43 
     44                        #results { 
     45                                color:darkred; 
    3446                        } 
    35                 ); 
    36                 logMessage = window.alert; 
    37         </script> 
    3847 
    39 <style> 
    40          
    41         @import "../themes/tundra/tundra.css"; 
    42  
    43         #widgetContainer { 
    44                 border:1px solid black; 
    45                 width:100%; 
    46         } 
    47  
    48         #results { 
    49                 color:darkred; 
    50         } 
    51  
    52 </style> 
    53         </head> 
    54 <body class=tundra> 
    55  
    56 <script language="php"> 
    57         echo    "<h2>Currently Parsing $count $className instances</h2>"; 
    58         echo    "Pass <code>?count=<i><b>100</b></i></code> in the query string to change the number of widgets.<br>"; 
    59         echo    "Pass <code>?class=<i><b>form.Button</b></i></code> in the query string to change the widget class."; 
    60 </script> 
    61  
    62 <h3 id="results"></h3> 
    63  
    64 <div id="widgetContainer" class='box'> 
    65  
    66 <script language="php"> 
    67         for($i=1; $i <= $count; $i++){ 
    68                 echo "<div dojoType='dijit.$className'>$className $i </div>"; 
    69         } 
    70 </script> 
    71 </div><br> 
    72 </body> 
     48                </style> 
     49        </head> 
     50        <body class=tundra> 
     51        <? 
     52                echo    "<h2>Currently Parsing $count $className instances</h2>"; 
     53                echo    "Pass <code>?count=<i><b>100</b></i></code> in the query string to change the number of widgets.<br>"; 
     54                echo    "Pass <code>?class=<i><b>form.Button</b></i></code> in the query string to change the widget class."; 
     55        ?> 
     56        <h3 id="results"></h3> 
     57        <div id="widgetContainer" class='box'> 
     58        <? 
     59                for($i=1; $i <= $count; $i++){ 
     60                        echo "<div dojoType='dijit.$className'>$className $i </div>"; 
     61                } 
     62        ?> 
     63        </div><br> 
     64        </body> 
    7365</html>