[Solar-svn] Revision 2868

pmjones at solarphp.com pmjones at solarphp.com
Sat Oct 13 08:40:18 CDT 2007


Solar_Controller_Page: [CHG] Removed ugly micro-optimization switch/case in _forward() method.


Modified: trunk/Solar/Controller/Page.php
===================================================================
--- trunk/Solar/Controller/Page.php	2007-10-13 13:38:40 UTC (rev 2867)
+++ trunk/Solar/Controller/Page.php	2007-10-13 13:40:17 UTC (rev 2868)
@@ -1023,32 +1023,11 @@
         $this->_view = $this->_getActionView($this->_action);
         
         // run the action method, which may itself _forward() to
-        // other actions.  pass all parameters in order.  use a
-        // little speed boost for shorter param lists.
-        switch (count($params)) {
-        case 0:
-            $this->$method();
-            break;
-        case 1:
-            $this->$method($params[0]);
-            break;
-        case 2:
-            $this->$method($params[0], $params[1]);
-            break;
-        case 3:
-            $this->$method($params[0], $params[1], $params[2]);
-            break;
-        case 4:
-            $this->$method($params[0], $params[1], $params[2], $params[3]);
-            break;
-        default:
-            // this is 2x slower than $this->$method
-            call_user_func_array(
-                array($this, $method),
-                $params
-            );
-            break;
-        }
+        // other actions.  pass all parameters in order.
+        call_user_func_array(
+            array($this, $method),
+            $params
+        );
         
         // run this after every action
         $this->_postAction();




More information about the Solar-svn mailing list