Tuning of XCL

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum

なし Tuning of XCL

msg# 1
Previous post - Next post | Parent - Children.1 .2 .3 .4 .5 | Posted on 2008/10/4 16:23 | Last modified
nobu  管理人   Posts: 206
Somebody say XCL is slow. So I'll be try tune of code.
At first, do profiling.
Setup Xdebug in PHP, get profile information.

.htaccess:
php_value xdebug.profiler_enable 1
php_value xdebug.profiler_output_dir /workdir/log
After this settings, to get profile dump file(cahcegrind.out.XXX) when display testing page on web browser. This file put in summery tools(KCachegrind) that able to check seconds/counts each functions(methods).

Then take a quick profile, there is a method "XoopsObject->assignVers" takes longest time in a method. There is a a theory to take largest part, try to hack hear.
--- kernel/object.php~	2007-05-15 11:34:38.000000000 +0900
+++ kernel/object.php	2008-10-04 15:05:17.941531461 +0900
@@ -241,9 +241,7 @@
     */
     function assignVar($key, $value)
     {
-        if (isset($value) && isset($this->vars[$key])) {
-            $this->vars[$key]['value'] =& $value;
-        }
+	$vars = &$this->vars;
+        if (isset($value) && isset($vars[$key])) $vars[$key]['value'] =& $value;
     }
 
     /**
@@ -254,8 +252,9 @@
     */
     function assignVars($var_arr)
     {
+	$vars = &$this->vars;
         foreach ($var_arr as $key => $value) {
-            $this->assignVar($key, $value);
+	    if (isset($value) && isset($vars[$key])) $vars[$key]['value'] = $value;
         }
     }
Well, these are redundant techniques if there is smart compiler for internal code. Reduce block, method call expanding, assign intermediate variable for reduce relative references.

This changing effect at showing userinfo.php page, revised time 88,833 to 5,019 (unit is micro sec?). In only this method gain more than 10times faster, 10% faster in all over page.

In tune of programs, like this step. But more effective tune for algorithm or redundant SQL revised.

I will be try more revised.
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2008/10/13 15:17 | Last modified
nobu  管理人   Posts: 206
Tuning #2

Try to use my brain bit more. At first using "Debug mode" set to "MySQL/Blocks " and inspect SQL sequence. Is there extra queries?
SELECT * FROM xxx_modules WHERE dirname='xxxx'

There is like this queries repeated. So, I checked this.
This is issuse by XoopsModule::getByDirname function in kernel/module.php file.
This function works with caching method. Ok I changed this, get value at once. Well, that will be prefetch style caching.
--- kernel/module.php.orig	2008-03-08 15:01:48.000000000 +0900
+++ kernel/module.php	2008-10-13 14:45:10.946721265 +0900
@@ -410,19 +410,20 @@
         
         if (!empty($this->_cachedModule_dirname[$dirname])) {
             $ret = $this->_cachedModule_dirname[$dirname];
-        } else {
-            $sql = "SELECT * FROM ".$this->db->prefix('modules')." WHERE dirname = ".$this->db->quoteString($dirname);
-            if ($result = $this->db->query($sql)) {
-                $numrows = $this->db->getRowsNum($result);
-                if ($numrows == 1) {
+        } elseif (count($this->_cachedModule_dirname)==0) {
+	    $db = $this->db;
+            $sql = "SELECT * FROM ".$db->prefix('modules');
+            if ($result = $db->query($sql)) {
+                while ($myrow = $db->fetchArray($result)) {
                     $module =& new XoopsModule();
-                    $myrow = $this->db->fetchArray($result);
                     $module->assignVars($myrow);
-                    $this->_cachedModule_dirname[$dirname] =& $module;
-                    $this->_cachedModule_mid[$module->getVar('mid')] =& $module;
-                    $ret =& $module;
+                    $this->_cachedModule_dirname[$myrow['dirname']] =& $module;
+                    $this->_cachedModule_mid[$myrow['mid']] =& $module;
                 }
             }
+	    if (!empty($this->_cachedModule_dirname[$dirname])) {
+		$ret = $this->_cachedModule_dirname[$dirname];
+	    }
         }
         return $ret;
     }
Profiling a sample module page with this hack. Result 18%(501554/613088) speedup(shorter time) over all. Um, Not worth.
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2008/10/13 17:18 | Last modified
nobu  管理人   Posts: 206
Tuning #3

Around XoopsSimpleObject::initVar method, much time use execution.
Only apply a technique for variable reference.
--- modules/legacy/kernel/object.php.orig	2007-06-24 23:58:52.000000000 +0900
+++ modules/legacy/kernel/object.php	2008-10-13 17:00:36.302753665 +0900
@@ -71,31 +71,32 @@
 		if (!isset($this->mVars[$key])) {
 			return;
 		}
-		
-		switch ($this->mVars[$key]['data_type']) {
+
+		$vars = &$this->mVars[$key];
+		switch ($vars['data_type']) {
 			case XOBJ_DTYPE_BOOL:
-				$this->mVars[$key]['value'] = $value ? 1 : 0;
+				$vars['value'] = $value ? 1 : 0;
 				break;
 
 			case XOBJ_DTYPE_INT:
-				$this->mVars[$key]['value'] = $value !== null ? intval($value) : null;
+				$vars['value'] = $value !== null ? intval($value) : null;
 				break;
 
 			case XOBJ_DTYPE_FLOAT:
-				$this->mVars[$key]['value'] = $value !== null ? floatval($value) : null;
+				$vars['value'] = $value !== null ? floatval($value) : null;
 				break;
 
 			case XOBJ_DTYPE_STRING:
-				if ($this->mVars[$key]['maxlength'] !== null && strlen($value) > $this->mVars[$key]['maxlength']) {
-					$this->mVars[$key]['value'] = xoops_substr($value, 0, $this->mVars[$key]['maxlength'], null);
+				if ($vars['maxlength'] !== null && strlen($value) > $vars['maxlength']) {
+					$vars['value'] = xoops_substr($value, 0, $vars['maxlength'], null);
 				}
 				else {
-					$this->mVars[$key]['value'] = $value;
+					$vars['value'] = $value;
 				}
 				break;
 
 			case XOBJ_DTYPE_TEXT:
-				$this->mVars[$key]['value'] = $value;
+				$vars['value'] = $value;
 				break;
 		}
 	}
@@ -153,24 +154,25 @@
 	function getShow($key)
 	{
 		$value = null;
-		
-		switch ($this->mVars[$key]['data_type']) {
+
+		$vars = &$this->mVars[$key];
+		switch ($vars['data_type']) {
 			case XOBJ_DTYPE_BOOL:
 			case XOBJ_DTYPE_INT:
 			case XOBJ_DTYPE_FLOAT:
-				$value = $this->mVars[$key]['value'];
+				$value = $vars['value'];
 				break;
 
 			case XOBJ_DTYPE_STRING:
 				$root =& XCube_Root::getSingleton();
 				$textFilter =& $root->getTextFilter();
-				$value = $textFilter->toShow($this->mVars[$key]['value']);
+				$value = $textFilter->toShow($vars['value']);
 				break;
 
 			case XOBJ_DTYPE_TEXT:
 				$root =& XCube_Root::getSingleton();
 				$textFilter =& $root->getTextFilter();
-				$value = $textFilter->toShowTarea($this->mVars[$key]['value'], 0, 1, 1, 1, 1);
+				$value = $textFilter->toShowTarea($vars['value'], 0, 1, 1, 1, 1);
 				break;
 		}
 		
Reviced 5% over all.
Votes:0 Average:0.00

なし Re: Tuning of XCL

msg# 1.1.1
Previous post - Next post | Parent - Children.1 | Posted on 2008/10/13 19:07
nobu  管理人   Posts: 206
Related kernel/module.php file, calling XoopsObject::initVar method many times. Then suppress this calling.
--- kernel/module.php.orig	2008-03-08 15:01:48.000000000 +0900
+++ kernel/module.php	2008-10-13 16:36:27.793055366 +0900
@@ -57,7 +57,12 @@
      */
     function XoopsModule()
     {
         $this->XoopsObject();
+	static $initVars;
+	if (isset($initVars)) {
+	    $this->vars = $initVars;
+	    return;
+	}
         $this->initVar('mid', XOBJ_DTYPE_INT, null, false);
         $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150);
         $this->initVar('version', XOBJ_DTYPE_INT, 100, false);
@@ -72,6 +77,7 @@
         $this->initVar('hascomments', XOBJ_DTYPE_INT, 0, false);
         // RMV-NOTIFY
         $this->initVar('hasnotification', XOBJ_DTYPE_INT, 0, false);
+	$initVars = $this->vars;
     }
 
     /**
Also kernel/configitem.php apply this modification.
--- kernel/configitem.php~	2007-05-15 11:34:38.000000000 +0900
+++ kernel/configitem.php	2008-10-13 16:40:43.476956532 +0900
@@ -73,6 +73,11 @@
      */
     function XoopsConfigItem()
     {
+	static $initVars;
+	if (isset($initVars)) {
+	    $this->vars = $initVars;
+	    return;
+	}
         $this->initVar('conf_id', XOBJ_DTYPE_INT, null, false);
         $this->initVar('conf_modid', XOBJ_DTYPE_INT, null, false);
         $this->initVar('conf_catid', XOBJ_DTYPE_INT, null, false);
@@ -83,6 +88,7 @@
         $this->initVar('conf_formtype', XOBJ_DTYPE_OTHER);
         $this->initVar('conf_valuetype', XOBJ_DTYPE_OTHER);
         $this->initVar('conf_order', XOBJ_DTYPE_INT);
+	$initVars = $this->vars;
     }
     
     /**
kernel/block.php, kernel/timezone.php, kernel/user.php also modifications.

Result calling times to lower (1223 to 122times). Also execution time make shorter in this method. But that is less than 1% revised at over all.
Votes:0 Average:0.00

なし Re: Tuning of XCL

msg# 1.2.1
Previous post - Next post | Parent - No child | Posted on 2008/10/13 23:48 | Last modified
nobu  管理人   Posts: 206
XoopsObject::getVar little bit technique revised in kernel/object.php.
--- kernel/object.php.orig	2007-05-15 11:34:38.000000000 +0900
+++ kernel/object.php	2008-10-13 23:32:23.794208584 +0900
@@ -333,8 +333,9 @@
     */
     function &getVar($key, $format = 's')
     {
-        $ret = $this->vars[$key]['value'];
-        switch ($this->vars[$key]['data_type']) {
+	$var = &$this->vars[$key];
+        $ret = $var['value'];
+        switch ($var['data_type']) {
 
         case XOBJ_DTYPE_TXTBOX:
             switch (strtolower($format)) {
@@ -363,11 +364,12 @@
             case 's':
             case 'show':
                 $ts =& MyTextSanitizer::getInstance();
-                $html = !empty($this->vars['dohtml']['value']) ? 1 : 0;
-                $xcode = (!isset($this->vars['doxcode']['value']) || $this->vars['doxcode']['value'] == 1) ? 1 : 0;
-                $smiley = (!isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1) ? 1 : 0;
-                $image = (!isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1) ? 1 : 0;
-                $br = (!isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1) ? 1 : 0;
+		$vars = &$this->vars;
+                $html = !empty($vars['dohtml']['value']) ? 1 : 0;
+                $xcode = (!isset($vars['doxcode']['value']) || $vars['doxcode']['value'] == 1) ? 1 : 0;
+                $smiley = (!isset($vars['dosmiley']['value']) || $vars['dosmiley']['value'] == 1) ? 1 : 0;
+                $image = (!isset($vars['doimage']['value']) || $vars['doimage']['value'] == 1) ? 1 : 0;
+                $br = (!isset($vars['dobr']['value']) || $vars['dobr']['value'] == 1) ? 1 : 0;
                 $ret = $ts->displayTarea($ret, $html, $smiley, $xcode, $image, $br);
                 break 1;
             case 'e':
@@ -376,12 +378,13 @@
                 break 1;
             case 'p':
             case 'preview':
+		$vars = &$this->vars;
                 $ts =& MyTextSanitizer::getInstance();
-                $html = !empty($this->vars['dohtml']['value']) ? 1 : 0;
-                $xcode = (!isset($this->vars['doxcode']['value']) || $this->vars['doxcode']['value'] == 1) ? 1 : 0;
-                $smiley = (!isset($this->vars['dosmiley']['value']) || $this->vars['dosmiley']['value'] == 1) ? 1 : 0;
-                $image = (!isset($this->vars['doimage']['value']) || $this->vars['doimage']['value'] == 1) ? 1 : 0;
-                $br = (!isset($this->vars['dobr']['value']) || $this->vars['dobr']['value'] == 1) ? 1 : 0;
+                $html = !empty($vars['dohtml']['value']) ? 1 : 0;
+                $xcode = (!isset($vars['doxcode']['value']) || $vars['doxcode']['value'] == 1) ? 1 : 0;
+                $smiley = (!isset($vars['dosmiley']['value']) || $vars['dosmiley']['value'] == 1) ? 1 : 0;
+                $image = (!isset($vars['doimage']['value']) || $vars['doimage']['value'] == 1) ? 1 : 0;
+                $br = (!isset($vars['dobr']['value']) || $vars['dobr']['value'] == 1) ? 1 : 0;
                 $ret = $ts->previewTarea($ret, $html, $smiley, $xcode, $image, $br);
                 break 1;
             case 'f':
@@ -424,12 +427,12 @@
             }
             break;
         default:
-            if ($this->vars[$key]['options'] != '' && $ret != '') {
+            if ($var['options'] != '' && $ret != '') {
                 switch (strtolower($format)) {
                 case 's':
                 case 'show':
                     $selected = explode('|', $ret);
-                    $options = explode('|', $this->vars[$key]['options']);
+                    $options = explode('|', $var['options']);
                     $i = 1;
                     $ret = array();
                     foreach ($options as $op) {
::getVar speedup 2% only, in over all same thing error rate?
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2008/10/14 0:46
nobu  管理人   Posts: 206
Tuning result until now
userinfo.php| 33%
edituser.php| 20%
notifications.php| 26%
modules/ccenter/| 11%
ccenter/reception.php| 20%
eguide/index.php| 22%

Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2008/10/18 0:06 | Last modified
nobu  管理人   Posts: 206
Not found effective point. Apply technique ad hoc pickups.
--- modules/user/preload/Primary/Primary.class.php	2008-07-13 18:59:00.000000000 +0900
+++ modules/user/preload/Primary/Primary.class.php	2008-10-17 23:48:29.726265290 +0900
@@ -45,28 +45,30 @@
 		if (is_object($context->mXoopsUser)) {
 			return;
 		}
-		
-		if (!empty($_SESSION['xoopsUserId'])) {
+
+		$xoopsUserId =& $_SESSION['xoopsUserId'];
+		if (!empty($xoopsUserId)) {
 			$memberHandler = xoops_gethandler('member');
-			$user =& $memberHandler->getUser($_SESSION['xoopsUserId']);
+			$user =& $memberHandler->getUser($xoopsUserId);
 			$context->mXoopsUser =& $user;
-			if (is_object($context->mXoopsUser)) {
-				$context->mXoopsUser->setGroups($_SESSION['xoopsUserGroups']);
+			if (is_object($user)) {
+				$xoopsUserGroups =& $_SESSION['xoopsUserGroups'];
+				$user->setGroups($xoopsUserGroups);
 				
 				$roles = array();
 				$roles[] = "Site.RegisteredUser";
-				if ($context->mXoopsUser->isAdmin(-1)) {
+				if ($user->isAdmin(-1)) {
 					$roles[] = "Site.Administrator";
 				}
-				if (in_array(XOOPS_GROUP_ADMIN, $_SESSION['xoopsUserGroups'])) {
+				if (in_array(XOOPS_GROUP_ADMIN, $xoopsUserGroups)) {
 					$roles[] = "Site.Owner";
 				}
 				
-				$identity =& new Legacy_Identity($context->mXoopsUser);
+				$identity =& new Legacy_Identity($user);
 				$principal = new Legacy_GenericPrincipal($identity, $roles);
 				return;
 			} else {
-				$context->mXoopsUser = null;
+				$user = null;
 				$_SESSION = array();
 			}
 		}
--- include/functions.php	2008-03-15 00:53:00.000000000 +0900
+++ include/functions.php	2008-10-17 23:34:10.105316817 +0900
@@ -571,15 +571,15 @@
 {
     static $handlers;
     $name = strtolower(trim($name));
-    if (!isset($handlers[$name])) {
+	$thandler = &$handlers[$name];
+    if (!isset($thandler)) {
 		//
 		// The following delegate is test at Alpha4-c.
 		//
 		$handler = null;
 		XCube_DelegateUtils::call('Legacy.Event.GetHandler', new XCube_Ref($handler), $name, $optional);
 		if (is_object($handler)) {
-			$handlers[$name] =& $handler;
-			return $handlers[$name];
+			return $thandler =& $handler;
 		}
 		
         if ( file_exists( $hnd_file = XOOPS_ROOT_PATH.'/kernel/'.$name.'.php' ) ) {
@@ -587,17 +587,17 @@
         }
         $class = 'Xoops'.ucfirst($name).'Handler';
         if (class_exists($class)) {
-            $handlers[$name] = new $class($GLOBALS['xoopsDB']);
+            $thandler = new $class($GLOBALS['xoopsDB']);
         }
     }
-    if (!isset($handlers[$name]) && !$optional ) {
+    if (!isset($thandler) && !$optional ) {
         trigger_error('Class <b>'.$class.'</b> does not exist<br />Handler Name: '.$name, E_USER_ERROR);
     }
 	
 	$falseRet = false;
 	
-    if (isset($handlers[$name]))
-        return $handlers[$name];
+    if (isset($thandler))
+        return $thandler;
 	else
         return $falseRet;
 }
@@ -608,8 +608,9 @@
     // if $module_dir is not specified
     if (!isset($module_dir)) {
         //if a module is loaded
-        if (isset($GLOBALS['xoopsModule']) && is_object($GLOBALS['xoopsModule'])) {
-            $module_dir = $GLOBALS['xoopsModule']->getVar('dirname');
+	global $xoopsModule;
+        if (isset($xoopsModule) && is_object($xoopsModule)) {
+            $module_dir = $xoopsModule->getVar('dirname');
         } else {
             trigger_error('No Module is loaded', E_USER_ERROR);
         }
@@ -617,7 +618,9 @@
         $module_dir = trim($module_dir);
     }
     $name = (!isset($name)) ? $module_dir : trim($name);
-    if (!isset($handlers[$module_dir][$name])) {
+    $handler = &$handlers[$module_dir];
+    $hname = $handler[$name];
+    if (!isset($hname)) {
 		//
 		// Cube Style
 		//
@@ -630,20 +633,20 @@
 		
 		$className = ucfirst(strtolower($module_dir)) . "_" . ucfirst($name) . 'Handler';
 		if (class_exists($className)) {
-			$handlers[$module_dir][$name] =& new $className($GLOBALS['xoopsDB']);
+			$hname =& new $className($GLOBALS['xoopsDB']);
 		}
 		else {
 			$className = ucfirst(strtolower($module_dir)) . ucfirst($name) . 'Handler';
 			if (class_exists($className)) {
-				$handlers[$module_dir][$name] = new $className($GLOBALS['xoopsDB']);
+				$hname = new $className($GLOBALS['xoopsDB']);
 			}
 		}
     }
-    if (!isset($handlers[$module_dir][$name]) && !$optional) {
+    if (!isset($hname) && !$optional) {
         trigger_error('Handler does not exist<br />Module: '.$module_dir.'<br />Name: '.$name, E_USER_ERROR);
     }
 	
-    return $handlers[$module_dir][$name];
+    return $hname;
 }
 
 function xoops_getrank($rank_id =0, $posts = 0)
Looks speedup in profiler numeric, but small revise in over all.
Votes:0 Average:0.00

なし Re: Tuning of XCL

msg# 1.1.1.1
Previous post - Next post | Parent - No child | Posted on 2008/10/18 0:18 | Last modified
nobu  管理人   Posts: 206
Quote:

kernel/block.php, kernel/timezone.php, kernel/user.php also modifications.
Post more patch to write myself.
--- kernel/block.php	2007-05-15 11:34:00.000000000 +0900
+++ kernel/block.php	2008-10-13 18:26:10.463840060 +0900
@@ -61,27 +61,33 @@
      **/
     function XoopsBlock($id = null)
     {
-        $this->initVar('bid', XOBJ_DTYPE_INT, null, false);
-        $this->initVar('mid', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('func_num', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 255);
-        $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150);
-        //$this->initVar('position', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, false, 150);
-        $this->initVar('content', XOBJ_DTYPE_TXTAREA, null, false);
-        $this->initVar('side', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('weight', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('visible', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('block_type', XOBJ_DTYPE_OTHER, null, false);
-        $this->initVar('c_type', XOBJ_DTYPE_OTHER, null, false);
-        $this->initVar('isactive', XOBJ_DTYPE_INT, null, false);
-        $this->initVar('dirname', XOBJ_DTYPE_TXTBOX, null, false, 50);
-        $this->initVar('func_file', XOBJ_DTYPE_TXTBOX, null, false, 50);
-        $this->initVar('show_func', XOBJ_DTYPE_TXTBOX, null, false, 50);
-        $this->initVar('edit_func', XOBJ_DTYPE_TXTBOX, null, false, 50);
-        $this->initVar('template', XOBJ_DTYPE_OTHER, null, false);
-        $this->initVar('bcachetime', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('last_modified', XOBJ_DTYPE_INT, time(), false);
+	static $initVars;
+	if (isset($initVars)) {
+	    $this->vars = $initVars;
+	} else {
+	    $this->initVar('bid', XOBJ_DTYPE_INT, null, false);
+	    $this->initVar('mid', XOBJ_DTYPE_INT, 0, false);
+	    $this->initVar('func_num', XOBJ_DTYPE_INT, 0, false);
+	    $this->initVar('options', XOBJ_DTYPE_TXTBOX, null, false, 255);
+	    $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, true, 150);
+	    //$this->initVar('position', XOBJ_DTYPE_INT, 0, false);
+	    $this->initVar('title', XOBJ_DTYPE_TXTBOX, null, false, 150);
+	    $this->initVar('content', XOBJ_DTYPE_TXTAREA, null, false);
+	    $this->initVar('side', XOBJ_DTYPE_INT, 0, false);
+	    $this->initVar('weight', XOBJ_DTYPE_INT, 0, false);
+	    $this->initVar('visible', XOBJ_DTYPE_INT, 0, false);
+	    $this->initVar('block_type', XOBJ_DTYPE_OTHER, null, false);
+	    $this->initVar('c_type', XOBJ_DTYPE_OTHER, null, false);
+	    $this->initVar('isactive', XOBJ_DTYPE_INT, null, false);
+	    $this->initVar('dirname', XOBJ_DTYPE_TXTBOX, null, false, 50);
+	    $this->initVar('func_file', XOBJ_DTYPE_TXTBOX, null, false, 50);
+	    $this->initVar('show_func', XOBJ_DTYPE_TXTBOX, null, false, 50);
+	    $this->initVar('edit_func', XOBJ_DTYPE_TXTBOX, null, false, 50);
+	    $this->initVar('template', XOBJ_DTYPE_OTHER, null, false);
+	    $this->initVar('bcachetime', XOBJ_DTYPE_INT, 0, false);
+	    $this->initVar('last_modified', XOBJ_DTYPE_INT, time(), false);
+	    $initVars = $this->vars;
+	}
 
         // for backward compatibility
         if (isset($id)) {
--- kernel/tplfile.php	2007-05-15 11:34:00.000000000 +0900
+++ kernel/tplfile.php	2008-10-13 18:28:58.744828286 +0900
@@ -37,6 +37,11 @@
 	function XoopsTplfile()
 	{
 		$this->XoopsObject();
+		static $initVars;
+		if (isset($initVars)) {
+			$this->vars = $initVars;
+			return;
+		}
 		$this->initVar('tpl_id', XOBJ_DTYPE_INT, null, false);
 		$this->initVar('tpl_refid', XOBJ_DTYPE_INT, 0, false);
 		$this->initVar('tpl_tplset', XOBJ_DTYPE_OTHER, null, false);
@@ -47,6 +52,7 @@
 		$this->initVar('tpl_module', XOBJ_DTYPE_OTHER, null, false);
 		$this->initVar('tpl_type', XOBJ_DTYPE_OTHER, null, false);
 		$this->initVar('tpl_source', XOBJ_DTYPE_SOURCE, null, false);
+		$initVars = $this->vars;
 	}
 
 	function &getSource()
--- kernel/user.php	2007-05-15 11:34:00.000000000 +0900
+++ kernel/user.php	2008-10-13 18:48:43.306136776 +0900
@@ -69,38 +69,44 @@
      */
     function XoopsUser($id = null)
     {
-        $this->initVar('uid', XOBJ_DTYPE_INT, null, false);
-        $this->initVar('name', XOBJ_DTYPE_TXTBOX, null, false, 60);
-        $this->initVar('uname', XOBJ_DTYPE_TXTBOX, null, true, 25);
-        $this->initVar('email', XOBJ_DTYPE_TXTBOX, null, true, 60);
-        $this->initVar('url', XOBJ_DTYPE_TXTBOX, null, false, 100);
-        $this->initVar('user_avatar', XOBJ_DTYPE_TXTBOX, null, false, 30);
-        $this->initVar('user_regdate', XOBJ_DTYPE_INT, null, false);
-        $this->initVar('user_icq', XOBJ_DTYPE_TXTBOX, null, false, 15);
-        $this->initVar('user_from', XOBJ_DTYPE_TXTBOX, null, false, 100);
-        $this->initVar('user_sig', XOBJ_DTYPE_TXTAREA, null, false, null);
-        $this->initVar('user_viewemail', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('actkey', XOBJ_DTYPE_OTHER, null, false);
-        $this->initVar('user_aim', XOBJ_DTYPE_TXTBOX, null, false, 18);
-        $this->initVar('user_yim', XOBJ_DTYPE_TXTBOX, null, false, 25);
-        $this->initVar('user_msnm', XOBJ_DTYPE_TXTBOX, null, false, 100);
-        $this->initVar('pass', XOBJ_DTYPE_TXTBOX, null, false, 32);
-        $this->initVar('posts', XOBJ_DTYPE_INT, null, false);
-        $this->initVar('attachsig', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('rank', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('level', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('theme', XOBJ_DTYPE_OTHER, null, false);
-        $this->initVar('timezone_offset', XOBJ_DTYPE_OTHER, null, false);
-        $this->initVar('last_login', XOBJ_DTYPE_INT, 0, false);
-        $this->initVar('umode', XOBJ_DTYPE_OTHER, null, false);
-        $this->initVar('uorder', XOBJ_DTYPE_INT, 1, false);
-        // RMV-NOTIFY
-        $this->initVar('notify_method', XOBJ_DTYPE_OTHER, 1, false);
-        $this->initVar('notify_mode', XOBJ_DTYPE_OTHER, 0, false); 
-        $this->initVar('user_occ', XOBJ_DTYPE_TXTBOX, null, false, 100);
-        $this->initVar('bio', XOBJ_DTYPE_TXTAREA, null, false, null);
-        $this->initVar('user_intrest', XOBJ_DTYPE_TXTBOX, null, false, 150);
-        $this->initVar('user_mailok', XOBJ_DTYPE_INT, 1, false);
+		static $initVars;
+		if (isset($initVars)) {
+			$this->vars = $initVars;
+		} else {
+			$this->initVar('uid', XOBJ_DTYPE_INT, null, false);
+			$this->initVar('name', XOBJ_DTYPE_TXTBOX, null, false, 60);
+			$this->initVar('uname', XOBJ_DTYPE_TXTBOX, null, true, 25);
+			$this->initVar('email', XOBJ_DTYPE_TXTBOX, null, true, 60);
+			$this->initVar('url', XOBJ_DTYPE_TXTBOX, null, false, 100);
+			$this->initVar('user_avatar', XOBJ_DTYPE_TXTBOX, null, false, 30);
+			$this->initVar('user_regdate', XOBJ_DTYPE_INT, null, false);
+			$this->initVar('user_icq', XOBJ_DTYPE_TXTBOX, null, false, 15);
+			$this->initVar('user_from', XOBJ_DTYPE_TXTBOX, null, false, 100);
+			$this->initVar('user_sig', XOBJ_DTYPE_TXTAREA, null, false, null);
+			$this->initVar('user_viewemail', XOBJ_DTYPE_INT, 0, false);
+			$this->initVar('actkey', XOBJ_DTYPE_OTHER, null, false);
+			$this->initVar('user_aim', XOBJ_DTYPE_TXTBOX, null, false, 18);
+			$this->initVar('user_yim', XOBJ_DTYPE_TXTBOX, null, false, 25);
+			$this->initVar('user_msnm', XOBJ_DTYPE_TXTBOX, null, false, 100);
+			$this->initVar('pass', XOBJ_DTYPE_TXTBOX, null, false, 32);
+			$this->initVar('posts', XOBJ_DTYPE_INT, null, false);
+			$this->initVar('attachsig', XOBJ_DTYPE_INT, 0, false);
+			$this->initVar('rank', XOBJ_DTYPE_INT, 0, false);
+			$this->initVar('level', XOBJ_DTYPE_INT, 0, false);
+			$this->initVar('theme', XOBJ_DTYPE_OTHER, null, false);
+			$this->initVar('timezone_offset', XOBJ_DTYPE_OTHER, null, false);
+			$this->initVar('last_login', XOBJ_DTYPE_INT, 0, false);
+			$this->initVar('umode', XOBJ_DTYPE_OTHER, null, false);
+			$this->initVar('uorder', XOBJ_DTYPE_INT, 1, false);
+			// RMV-NOTIFY
+			$this->initVar('notify_method', XOBJ_DTYPE_OTHER, 1, false);
+			$this->initVar('notify_mode', XOBJ_DTYPE_OTHER, 0, false); 
+			$this->initVar('user_occ', XOBJ_DTYPE_TXTBOX, null, false, 100);
+			$this->initVar('bio', XOBJ_DTYPE_TXTAREA, null, false, null);
+			$this->initVar('user_intrest', XOBJ_DTYPE_TXTBOX, null, false, 150);
+			$this->initVar('user_mailok', XOBJ_DTYPE_INT, 1, false);
+			$initVars = $this->vars;
+		}
 
         // for backward compatibility
         if (isset($id)) {
Votes:0 Average:0.00

なし Re: Tuning of XCL

msg# 1.3.1
Previous post - Next post | Parent - No child | Posted on 2008/10/26 18:22 | Last modified
nobu  管理人   Posts: 206
By the way, There is a article reparation in XOOPS2 derived CMS. And XCL was slowest.(The article)

That result was following. XOOPS20JP faster 30% than XCL 2.1. These are patches makes that nearly speed?

Quote:
1) Xoops20JP  279 ms
2) Xoops Mexico  279 ms
3) Xoops20  296 ms
4) Xoops 2.3.0  307 ms
5) ImpressCMS  321 ms
6) Xoops2.2.6  326 ms
7) Simple-Xoops  349 ms
8) XoopsCube  397 ms
Well, here to use technical methods are also use other programs.
Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2010/3/5 11:32 | Last modified
nobu  管理人   Posts: 206
Here is experiment result commit to XCL 2.2 branches.
Thank you, kilica.

This is trivial work, however good for feedback to mainline.
Votes:0 Average:0.00

  Advanced search


Login
Username:

Password:


Lost Password?

Register now!
Developed by Nobuhiro YASUTOMI 2007
Notice [PHP]: Use of undefined constant _MI_RP_REFERER_TPL - assumed '_MI_RP_REFERER_TPL' in file modules/refpage/xoops_version.php line 38