MyBB Community Forums

Full Version: Optimizations Techniques - MyBB 2.0
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Apostrophes or heredoc should be used for readability at least (they won't really optimise the script), when needed of course. For example here:
https://github.com/mybb/mybb/blob/featur...r.php#L302
https://github.com/mybb/mybb/blob/featur....php#L1148

I don't get why strings like this are enclosed in double quotes...
(2014-08-15, 05:47 PM)pavemen Wrote: [ -> ]
(2014-08-15, 04:59 PM)Axareal Wrote: [ -> ]
(2014-08-15, 04:00 PM)Jabberwock Wrote: [ -> ]First I would recommend that whenever possible double quotes to writing simple strings shouldn't be used, instead 1 quote will be used as PHP doesn't parse variables there.
There's not really much point in micro-optimizations like this.
The time saved would be so insignificant.

but for a big board, that time adds up

It's so tiny that it would be lost in the noise. It's hard to even measure it, let alone get a real world improvement.
Not to mention, the larger differences were due to older versions of PHP. The gap is even smaller now with new versions.
im not talking about a single request though. i am talking about millions of near simultaneous requests where things add up at the system level, not on a single request level.
(2014-08-17, 03:54 PM)pavemen Wrote: [ -> ]im not talking about a single request though. i am talking about millions of near simultaneous requests where things add up at the system level, not on a  single request level.

Bumping up requirements for a higher version of PHP usually does a lot more for performance, as they're always coming up with ways to optimize it like new functions. Honestly though, there are probably more significant areas to optimize than tiny ones like this and MyBB seems to do a little dance for getting around things like register_globals. That can't be helping performance.

If it was up to me then, I'd just throw an error if register_globals was enabled, instead of trying to kinda work around it.
While PHP5.4 gets rid of it entirely, which MyBB may or may not be requiring depending on what framework it goes for.

https://github.com/mybb/mybb/blob/master...e.php#L292 Line 292
MyBB does a lot of work to work around register_globals.

if(isset($this->input['action']) && $this->input['action'] == "mybb_logo")
{
require_once dirname(__FILE__)."/mybb_group.php";
output_logo();
}
Why is this in class_core? class_core is run by every single MyBB file so, that's a performance issue.

Basically, there's usually a lot more low hanging branches to optimize than, going for the diminishing returns path.
I am not arguing whether there are better ways to optimize, i was just countering the statement that what i am talking about has no real impact.
You are right that there are many workarounds that should be removed, but that's why version 2.0 is going to be written from scratch... As for the logo stuff you pointed out, it's behind an if statment. It won't slow down at all.

I think it would be benifical if MyBB core file will be written such as the first init.php file will simply connect to database and execute the session code (Maybe also the settings, but if so then it should have an option to turn it off). And only in global.php it will start to load MyBB related stuff.
Why is that you ask? There are things like ajax or plugins that need a shortcut. Simple and effecient code to connect to database, retrieve the beneficial info and close.


(2014-08-16, 07:58 PM)Euan T Wrote: [ -> ]Yes, it's  certain eval will not be used at all in 2.0.


That's very good to hear. Smile So how are you going to overcome it?
There won't be a init.php or global.php file.

MyBB 2.0 will use an MVC framework and autoloading.
MVC framework? What is that? Can you enlighten me?
(2014-08-17, 04:45 PM)pavemen Wrote: [ -> ]I am not arguing whether there are better ways to optimize, i was just countering the statement that what i am talking about has no real impact.

I remembered one of the PHP Core Developers writing about that and it took a while to find it:
http://nikic.github.io/2012/01/09/Dispro...-Myth.html
(2014-08-17, 05:26 PM)Jabberwock Wrote: [ -> ]MVC framework? What is that? Can you enlighten me?

http://en.wikipedia.org/wiki/Model%E2%80...controller

The plan was, and I believe still is, to use Laravel.

http://laravel.com/

So the framework will handle most of the heavy stuff while the developers concentrate on building the actual forum software. The framework will add some overhead but the trade-off is worth it.
Pages: 1 2 3 4