MyBB Community Forums

Full Version: How Many Queries?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
Index: 9
Forumdisplay: 23
Showthread: 23
Generated in 0.0871000 seconds (92.56% PHP / 7.44% MySQL)
SQL Queries: 15 / Global Parsing Time: 0.0646520 / Memory Usage: 8.25 MB
PHP version: <snip> / Server Load: 0.02 / GZip Compression: Enabled

^ http://herooftime.net

Generated in 0.0368991 seconds (89.42% PHP / 10.58% MySQL)
SQL Queries: 9 / Global Parsing Time: 0.0221250 / Memory Usage: 4 MB
PHP version: <snip> / Server Load: 0.08 / GZip Compression: Disabled

^ http://www.worldsworstforum.tk/
Index:

Generated in 0.3575571 seconds (70.44% PHP / 29.56% MySQL)
SQL Queries: 82 / Global Parsing Time: 0.0963531 / Memory Usage: 11 MB
PHP version: 5.2.17 / Server Load: 7.72 / GZip Compression: Enabled

SQL Queries: 70 / Global Parsing Time: 0.1524818 / Memory Usage: 4 MB
If you want to know what plugins the queries are actually coming from you can make a simple pair of edits to /inc/class_plugins.php. Ihave posted this previously at

http://community.mybb.com/thread-88358-p...#pid646406


edit: actually the above no longer works. It takes a little more effirt but it totally doable. here is my run_hooks and run_hooks_by_ref functions from /inc/class_plugins.php. The changes are the 4 lines containing $hookname

	/**
	 * Run the hooks that have plugins.
	 *
	 * @param string The name of the hook that is run.
	 * @param string The argument for the hook that is run. The passed value MUST be a variable
	 * @return string The arguments for the hook.
	 */
	function run_hooks($hook, $arguments="")
	{
		if(!is_array($this->hooks[$hook]))
		{
			return $arguments;
		}
		$this->current_hook = $hook;
		$hookname = $hook;
		ksort($this->hooks[$hook]);
		foreach($this->hooks[$hook] as $priority => $hooks)
		{
			if(is_array($hooks))
			{
				foreach($hooks as $hook)
				{
					if($hook['file'])
					{
						require_once $hook['file'];
					}
					$this->current_hook = $hookname.'-'.$hook['function']; 
					$returnargs = call_user_func_array($hook['function'], array(&$arguments));
					
					
					if($returnargs)
					{
						$arguments = $returnargs;
					}
				}
			}
		}
		$this->current_hook = '';
		return $arguments;
	}
	
	/**
	 * DEPRECIATED
	 * Run the hooks that have plugins but passes REQUIRED argument by reference.
	 * This is a separate function to provide backwards compat with PHP 4.
	 *
	 * @param string The name of the hook that is run.
	 * @param string The argument for the hook that is run - passed by reference. The passed value MUST be a variable
	 */
	function run_hooks_by_ref($hook, &$arguments)
	{
		if(empty($this->hooks[$hook]) && !is_array($this->hooks[$hook]))
		{
			return $arguments;
		}
		$this->current_hook = $hook;
		$hookname = $hook;
		ksort($this->hooks[$hook]);
		foreach($this->hooks[$hook] as $priority => $hooks)
		{
			if(is_array($hooks))
			{
				foreach($hooks as $hook)
				{
					if($hook['file'])
					{
						require_once $hook['file'];
					}
					$this->current_hook = $hookname.'-'.$hook['function']; 
					call_user_func_array($hook['function'], array(&$arguments));				
				}
			}
		}
		$this->current_hook = '';
	}	

Paveman that would be useful especially to those with a couple dozen plugins.
(2011-10-13, 04:58 PM)labrocca Wrote: [ -> ]Paveman that would be useful especially to those with a couple dozen plugins.

exactly why I added it to my own site
Index page:
Generated in 0.0487940 seconds (73.61% PHP / 26.39% MySQL)
SQL Queries: 13 / Global Parsing Time: 0.0281479 / Memory Usage: 4.75 MB

Showthread:
Generated in 0.0949230 seconds (77.79% PHP / 22.21% MySQL)
SQL Queries: 20 / Global Parsing Time: 0.0315261 / Memory Usage: 5.5 MB
(2011-10-13, 04:31 PM)pavemen Wrote: [ -> ]If you want to know what plugins the queries are actually coming from you can make a simple pair of edits to /inc/class_plugins.php. Ihave posted this previously at

http://community.mybb.com/thread-88358-p...#pid646406


edit: actually the above no longer works. It takes a little more effirt but it totally doable. here is my run_hooks and run_hooks_by_ref functions from /inc/class_plugins.php. The changes are the 4 lines containing $hookname

	/**
	 * Run the hooks that have plugins.
	 *
	 * @param string The name of the hook that is run.
	 * @param string The argument for the hook that is run. The passed value MUST be a variable
	 * @return string The arguments for the hook.
	 */
	function run_hooks($hook, $arguments="")
	{
		if(!is_array($this->hooks[$hook]))
		{
			return $arguments;
		}
		$this->current_hook = $hook;
		$hookname = $hook;
		ksort($this->hooks[$hook]);
		foreach($this->hooks[$hook] as $priority => $hooks)
		{
			if(is_array($hooks))
			{
				foreach($hooks as $hook)
				{
					if($hook['file'])
					{
						require_once $hook['file'];
					}
					$this->current_hook = $hookname.'-'.$hook['function']; 
					$returnargs = call_user_func_array($hook['function'], array(&$arguments));
					
					
					if($returnargs)
					{
						$arguments = $returnargs;
					}
				}
			}
		}
		$this->current_hook = '';
		return $arguments;
	}
	
	/**
	 * DEPRECIATED
	 * Run the hooks that have plugins but passes REQUIRED argument by reference.
	 * This is a separate function to provide backwards compat with PHP 4.
	 *
	 * @param string The name of the hook that is run.
	 * @param string The argument for the hook that is run - passed by reference. The passed value MUST be a variable
	 */
	function run_hooks_by_ref($hook, &$arguments)
	{
		if(empty($this->hooks[$hook]) && !is_array($this->hooks[$hook]))
		{
			return $arguments;
		}
		$this->current_hook = $hook;
		$hookname = $hook;
		ksort($this->hooks[$hook]);
		foreach($this->hooks[$hook] as $priority => $hooks)
		{
			if(is_array($hooks))
			{
				foreach($hooks as $hook)
				{
					if($hook['file'])
					{
						require_once $hook['file'];
					}
					$this->current_hook = $hookname.'-'.$hook['function']; 
					call_user_func_array($hook['function'], array(&$arguments));				
				}
			}
		}
		$this->current_hook = '';
	}	


I know this is a super old thread so sorry for that. i came across it from google.

Any way i was getting this
FORUMDISPLAY
Generated in 0.1159451 seconds (90.74% PHP / 9.26% MySQL)
SQL Queries: 62 / Global Parsing Time: 0.0792220 / Memory Usage: 9.5 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0.06 / GZip Compression: Enabled

SHOWTHREAD
Generated in 0.2431362 seconds (92.45% PHP / 7.55% MySQL)
SQL Queries: 67 / Global Parsing Time: 0.1356101 / Memory Usage: 11.75 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0 / GZip Compression: Enabled

PORTAL
Generated in 0.1181221 seconds (91.78% PHP / 8.22% MySQL)
SQL Queries: 55 / Global Parsing Time: 0.0643442 / Memory Usage: 9 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0 / GZip Compression: Enabled

INDEX
Generated in 0.1727469 seconds (92.57% PHP / 7.43% MySQL)
SQL Queries: 81 / Global Parsing Time: 0.0968959 / Memory Usage: 9.75 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0 / GZip Compression: Enabled

DOWNLOADS
Generated in 0.1171820 seconds (-506.59% PHP / 606.59% MySQL)
SQL Queries: 51 / Global Parsing Time: 0.0810649 / Memory Usage: 8.75 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0 / GZip Compression: Enabled

and then i did your code tweak used patches plugin Smile

found out a few plugins causing issues (mainly pro stats) so disabled them and removed unused hooks from some other plugins now i get
FORUMDISPLAY
Generated in 0.0867000 seconds (92.87% PHP / 7.13% MySQL)
SQL Queries: 27 / Global Parsing Time: 0.0642519 / Memory Usage: 8.5 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0.06 / GZip Compression: Enabled

SHOWTHREAD
Generated in 0.0996730 seconds (93.45% PHP / 6.55% MySQL)
SQL Queries: 28 / Global Parsing Time: 0.0671899 / Memory Usage: 9.25 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0.07 / GZip Compression: Enabled

PORTAL
Generated in 0.1005721 seconds (95.95% PHP / 4.05% MySQL)
SQL Queries: 19 / Global Parsing Time: 0.0616829 / Memory Usage: 8.25 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0.16 / GZip Compression: Enabled

INDEX
Generated in 0.1041021 seconds (95.85% PHP / 4.15% MySQL)
SQL Queries: 15 / Global Parsing Time: 0.0708210 / Memory Usage: 8.75 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0.15 / GZip Compression: Enabled

DOWNLOADS
Generated in 0.1073830 seconds (93.59% PHP / 6.41% MySQL)
SQL Queries: 18 / Global Parsing Time: 0.0656309 / Memory Usage: 8 MB
PHP version: 5.4.4-14+deb7u12 / Server Load: 0.11 / GZip Compression: Enabled

So thanks for the tip on the code edit Smile
Pages: 1 2 3 4 5 6