Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP IF Statements & Server Overhead
Old 08-16-2009, 04:06 PM PHP IF Statements & Server Overhead
undoIT's Avatar
Average Talker

Latest Blog Post:
Alienware coupon code
Posts: 27
Trades: 0
How much server overhead there is when PHP if statements are evaluated, i.e. memory consumption and CPU usage? For example, if I have a WordPress blog and use a lot of if statements to render each post summary on the home page, is this going to require a great deal more server resources if the home page starts getting high traffic? And, on pages where many posts are listed (i.e. category pages) , it seems like this could become an issue.

Or, is this something I shouldn't even be worrying about?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
undoIT is offline
Reply With Quote
View Public Profile Visit undoIT's homepage!
 
 
Register now for full access!
Old 08-16-2009, 04:13 PM Re: PHP IF Statements & Server Overhead
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Or, is this something I shouldn't even be worrying about?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-16-2009, 04:25 PM Re: PHP IF Statements & Server Overhead
undoIT's Avatar
Average Talker

Latest Blog Post:
Alienware coupon code
Posts: 27
Trades: 0
Gotcha
undoIT is offline
Reply With Quote
View Public Profile Visit undoIT's homepage!
 
Old 08-16-2009, 06:36 PM Re: PHP IF Statements & Server Overhead
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
Evaluating conditions and arguments is the heart of programming logic. But you can streamline your logic flow by assinging your values to varibles to help aid in redundant evaluations from methods and functions that can take up valuable resources.

For example, using logic operator procedence, you can streamline a conditional statement:

PHP Code:
// Not streamlined:
if (resource_intensive_method() OR (!resource_intensive_method() AND $a == $b))
 
 
// Streamlined:
if ($value resource_intensive_method() OR (!$value AND $a == $b)) 
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP IF Statements & Server Overhead
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21521 seconds with 12 queries