Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2017-05-19 21:55:11

TigerAero
Member
From: Northwoods, WI, USA, Earth
Registered: 2009-02-01
Posts: 458
Website

PHP 5/7 Performance question (re: cached, memory, page calls)

So this is completely off topic as I'm doing volunteer work for a local non-profit who grows greens and veggies for the local community.

My question is this. I started with some really half-arsed functions that was basically a rewrite of strtoupper and normal php commands (I don't know...LOL...) with fancy names like makeUppercase. Lol. ((This is all code from the previous college student who didn't really seem to care about his code. sad ))

That being said there's a total of about 25 of them. I read on stack overflow it's ok to keep them housed in a single config file that includes the db connect string.

Is there any other optimization I could do. For example separate them into a few logical classes? There is some logical to some of them. I read on that same SO page that all our pages are literally read and basically thrown out over milliseconds.

That completely threw me for a loop. They basically taught us in my college classes that if you include a config file for example in your header.php file (as an example) it will be reread and cached generally (depending on Apache configuration) without any special lines or additional programming on your end. Is this simply not the case?

Is the full config file re-written, variables re-written and functions re-written...you know? Or am I misunderstanding something?

Thanks much for any help/tips!

Last edited by TigerAero (2017-05-19 21:56:08)

Offline

#2 2017-05-20 09:25:57

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,724
Website

Re: PHP 5/7 Performance question (re: cached, memory, page calls)

If the file is included on every request, it is also "executed" on every request. Execution in this case means parsing the file and defining the functions. Modern PHP versions usually cache the parsing part, and defining a few functions should be negligible in terms of performance.

So, what you were told sounds a little bit too good to be true, but is also not too far away from the truth. wink


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

Board footer

Powered by FluxBB