Jump to content

Recommended Posts

* Garbage Collection - PHP takes care of this, but putting __destruct methods in your classes will also help.

* unsetting of variables - You should unset any arrays, particularly if they are large

* Clearing of objects from memory - PHP will clean this up, but remember to do clean-ups in your destructor

* Server side status - not sure what you would want to monitor here

 

The bottom line: invest time into learning how to code well.  Any idiot can write code in PHP, but not everyone can code efficiently.  If you write code well, you shouldn't have to worry about the above.

 

You can also look at using a PHP framework which will automate some of the above.  Some frameworks also include page caching which will make your pages re-use database queries more effectively.

Link to comment
https://forums.phpfreaks.com/topic/101975-page-optimization/#findComment-521876
Share on other sites

When!

 

Is not realising what you have not done an exscuse for being foolish?

 

And yes there are ways of doing things, however there is always the most efficient, practical and safest way to do them!

 

But hey we are here to learn and i've generally learnt the hard way, but at least I know why...

Link to comment
https://forums.phpfreaks.com/topic/101975-page-optimization/#findComment-521884
Share on other sites

random1, there are many different forms of optimization -

http://en.wikipedia.org/wiki/Optimization_(computer_science)

 

You can optimize code to use fewer resources. You can optimize code to execute quicker. You can optimize code to be general purpose and independent of the type and amount of data it operates on. You can optimize code to be version/platform independent. Often these goals are mutually exclusive. You need to pick the one you want most.

 

But optimizing code means to change what it is doing during its' execution. This has little to do with when a page loads (unless you are creating unnecessary variables/objects and your goal is to optimize resources) and it has nothing to do with what you do on a page exit in php as all resources used by a script are destroyed when the script ends (see Daniel0's post.)

 

What you do to optimize any piece of code is dependent on what it is doing now (it might be as optimized as it can be) and on what optimization goal you are trying to achieve.

 

Your question is fairly general. Do you have a specific problem that is occurring you are trying to solve? Since optimization is highly situational, it is not really possible to give a specific list of things to do unless you have a specific problem or goal and a specific piece of code you want help with.

Link to comment
https://forums.phpfreaks.com/topic/101975-page-optimization/#findComment-521939
Share on other sites

Any idiot can write code in PHP, but not everyone can code efficiently.

 

That idiot may be me, you or alot others. If i cant write code efficiently, it means im an idiot? Anyone instead of any idiot could have been alot more appropriate.

 

Calm down. AP81's sentence doesn't actually imply that if you can't code efficiently then you are an idiot.

Link to comment
https://forums.phpfreaks.com/topic/101975-page-optimization/#findComment-521947
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.