Possible big optimisation of $auth->acl-get(s)

General discussion of development ideas and the approaches taken in the 3.x branch of phpBB. The next feature release of phpBB 3 will be 3.3/Proteus.
Forum rules
Please do not post support questions regarding installing, updating, or upgrading phpBB 3.2.x. If you need support for phpBB 3.2.x please visit the 3.2.x Support Forum on phpbb.com.

If you have questions regarding writing extensions please post in Extension Writers Discussion to receive proper guidance from our staff and community.
User avatar
Geolim4
Registered User
Posts: 10
Joined: Thu Sep 13, 2012 11:14 pm

Re: Possible big optimisation of $auth->acl-get(s)

Post by Geolim4 »

nickvergessen wrote:the number of circles is mostly <100
I agree, but the specific purpose of 3.1.x isn't to optimize the phpbb core untill the most little optimization??
And the specific purpose of this topic isn't to worth the confussion, but to involve in the phpBB project, don't take it bad bro :/

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1845
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Possible big optimisation of $auth->acl-get(s)

Post by DavidIQ »

So your suggestion is to load all auths into a variable for each user at load time (hundreds of them is most likely) and this would be more efficient? What happens when the server has several hundred users browsing on it?
Image

User avatar
Geolim4
Registered User
Posts: 10
Joined: Thu Sep 13, 2012 11:14 pm

Re: Possible big optimisation of $auth->acl-get(s)

Post by Geolim4 »

Nope, you don't understand....
See below:

Code: Select all

	$user_data = $user->data;
	
	while ( $row = $db->sql_fetchrow($result) )	
		{
			$template->assign_block_vars('our_block', array(
						'USERNAME'	=> $user_data['username'],
						'USER_ID'	=> $user_data['user_id'],
						'USER_EMAIL' $user_data['user_email'],
						//AND MANY OTHER

			));
		}
	while ( $row = $db->sql_fetchrow($result) )	
		{
			$template->assign_block_vars('our_block', array(
						'USERNAME'	=> $user->data['username'],
						'USER_ID'	=> $user->data['user_id'],
						'USER_EMAIL' $user->data['user_email'],
						//AND MANY OTHER

			));			
		}
Who will be faster? :geek:
I agree it's for some m.seconds, but on a CMS like phpbb each m.second are important !!

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: Possible big optimisation of $auth->acl-get(s)

Post by MichaelC »

geolim4 wrote:Nope, you don't understand....
See below:

Code: Select all

	$user_data = $user->data;
	
	while ( $row = $db->sql_fetchrow($result) )	
		{
			$template->assign_block_vars('our_block', array(
						'USERNAME'	=> $user_data['username'],
						'USER_ID'	=> $user_data['user_id'],
						'USER_EMAIL' $user_data['user_email'],
						//AND MANY OTHER

			));
		}
	while ( $row = $db->sql_fetchrow($result) )	
		{
			$template->assign_block_vars('our_block', array(
						'USERNAME'	=> $user->data['username'],
						'USER_ID'	=> $user->data['user_id'],
						'USER_EMAIL' $user->data['user_email'],
						//AND MANY OTHER

			));			
		}
Who will be faster? :geek:
I agree it's for some m.seconds, but on a CMS like phpbb each m.second are important !!
This topic is about $auth->acl-get('a_') not $user->data?

But if I'm honest this seems like a pointless micro-optimisation and is probably not worth it.
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
Geolim4
Registered User
Posts: 10
Joined: Thu Sep 13, 2012 11:14 pm

Re: Possible big optimisation of $auth->acl-get(s)

Post by Geolim4 »

Unknown Bliss wrote: But if I'm honest this seems like a pointless micro-optimisation and is probably not worth it.
That "micro-optimisation" like you call it, is a non-negligible optimization for big board with many forum, many users, many trafic and probably more...

User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 1845
Joined: Thu Mar 02, 2006 4:29 pm
Location: Earth
Contact:

Re: Possible big optimisation of $auth->acl-get(s)

Post by DavidIQ »

geolim4 wrote:Nope, you don't understand....
See below:

Code: Select all

	$user_data = $user->data;
	
	while ( $row = $db->sql_fetchrow($result) )	
		{
			$template->assign_block_vars('our_block', array(
						'USERNAME'	=> $user_data['username'],
						'USER_ID'	=> $user_data['user_id'],
						'USER_EMAIL' $user_data['user_email'],
						//AND MANY OTHER

			));
		}
	while ( $row = $db->sql_fetchrow($result) )	
		{
			$template->assign_block_vars('our_block', array(
						'USERNAME'	=> $user->data['username'],
						'USER_ID'	=> $user->data['user_id'],
						'USER_EMAIL' $user->data['user_email'],
						//AND MANY OTHER

			));			
		}
Who will be faster? :geek:
I agree it's for some m.seconds, but on a CMS like phpbb each m.second are important !!
They'd both be almost identical with the benefits being next to nothing and probably less than milliseconds of benefits and closer to microseconds or even less than that. You've jumped from talking about $auth->acl_get to $user->data which are two very different things. $auth->acl_get is a method call. $user->data is not.
Image

User avatar
Geolim4
Registered User
Posts: 10
Joined: Thu Sep 13, 2012 11:14 pm

Re: Possible big optimisation of $auth->acl-get(s)

Post by Geolim4 »

I agree, it's off topic, but if you think the benefits so you have reason...

ABDev
Registered User
Posts: 9
Joined: Mon Aug 15, 2005 9:47 pm
Location: Lens - France
Contact:

Re: Possible big optimisation of $auth->acl-get(s)

Post by ABDev »

If an user chooses to display more than 100 posts/users per page, the lack of optimization may be felt :).

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: Possible big optimisation of $auth->acl-get(s)

Post by MichaelC »

geolim4 wrote:
Unknown Bliss wrote: But if I'm honest this seems like a pointless micro-optimisation and is probably not worth it.
That "micro-optimisation" like you call it, is a non-negligible optimization for big board with many forum, many users, many trafic and probably more...
phpBB.com gets 5 million views a month, 25,000 unique visitors daily and hundreds of thousands of members; I think that constitutes a big(ish) board ;). This would not shave off even 0.001 seconds of the php execution time. Obviously there are larger boards out there (the largest I know is 26m members) which might have a bit of a larger impact but still not worth it.

Micro-optimisations are called that for a reason; they are too micro to be considered during development. Micro-optimisations damage code readability and maintainability for the sake of minuscule performance boosts which will impact a very small number of boards. And if a board is large enough to have those issues then they'd have the resources to micro-optimise whatever they needed too although their hardware would generally be powerful enough to keep php execution time down anyway.
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: Possible big optimisation of $auth->acl-get(s)

Post by callumacrae »

brunoais wrote:That is a quite significant improvement, yeah...
Actually, it is only an improvement of 0.0000012800693511955 seconds per call.
Made by developers, for developers!
My blog

Post Reply