FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How many PHP calls is too many for one webpage?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
How many PHP calls is too many for one webpage? [message #173486] Fri, 15 April 2011 19:09 Go to next message
Evolution is currently offline  Evolution
Messages: 14
Registered: April 2011
Karma: 0
Junior Member
On my homepage, I have five 'require_once' calls and within one of
those, two more 'require_once' calls. I want to increase this from
those seven to about twelve. This seems like no problem but I'm
wondering what the most anyone else has tried without any costly
degradation of load time.
Thanks a bunch.
Re: How many PHP calls is too many for one webpage? [message #173487 is a reply to message #173486] Fri, 15 April 2011 19:17 Go to previous messageGo to next message
Evolution is currently offline  Evolution
Messages: 14
Registered: April 2011
Karma: 0
Junior Member
On Apr 15, 12:09 pm, Evolution <cryptoz...@gmail.com> wrote:
> On my homepage, I have five 'require_once' calls and within one of
> those, two more 'require_once' calls.  I want to increase this from
> those seven to about twelve.  This seems like no problem but I'm
> wondering what the most anyone else has tried without any costly
> degradation of load time.
> Thanks a bunch.

To be more specific, what I want to do is include other php files to
make up my sidebar based on which page I'm calling from. For example,
I don't want to include a link to our schedule of speakers if that is
the page that I am on. Would a case statement be the best way to
handle this?

p.s. if not obvious, I'm a php newbie.
Re: How many PHP calls is too many for one webpage? [message #173488 is a reply to message #173487] Fri, 15 April 2011 19:27 Go to previous messageGo to next message
Luuk is currently offline  Luuk
Messages: 329
Registered: September 2010
Karma: 0
Senior Member
On 15-04-2011 21:17, Evolution wrote:
> On Apr 15, 12:09 pm, Evolution <cryptoz...@gmail.com> wrote:
>> On my homepage, I have five 'require_once' calls and within one of
>> those, two more 'require_once' calls. I want to increase this from
>> those seven to about twelve. This seems like no problem but I'm
>> wondering what the most anyone else has tried without any costly
>> degradation of load time.
>> Thanks a bunch.
>
> To be more specific, what I want to do is include other php files to
> make up my sidebar based on which page I'm calling from. For example,
> I don't want to include a link to our schedule of speakers if that is
> the page that I am on. Would a case statement be the best way to
> handle this?
>
> p.s. if not obvious, I'm a php newbie.

Every 'require_once' requires the server to open that (php-)file.

This should normally not be a problem, because if you have enough
memory, and the file is used often enough, the contents of this file
will be cached.

You should, of course, only 'require_once' files that you really need,
and skipp files that you do not need.

--
Luuk
Re: How many PHP calls is too many for one webpage? [message #173492 is a reply to message #173486] Fri, 15 April 2011 19:59 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Evolution wrote:
> On my homepage, I have five 'require_once' calls and within one of
> those, two more 'require_once' calls. I want to increase this from
> those seven to about twelve. This seems like no problem but I'm
> wondering what the most anyone else has tried without any costly
> degradation of load time.
> Thanks a bunch.
chances are it will all be cached in RAM anyway.
So not much...
Re: How many PHP calls is too many for one webpage? [message #173494 is a reply to message #173487] Fri, 15 April 2011 20:06 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
Evolution wrote:
> On Apr 15, 12:09 pm, Evolution <cryptoz...@gmail.com> wrote:
>> On my homepage, I have five 'require_once' calls and within one of
>> those, two more 'require_once' calls. I want to increase this from
>> those seven to about twelve. This seems like no problem but I'm
>> wondering what the most anyone else has tried without any costly
>> degradation of load time.
>> Thanks a bunch.
>
> To be more specific, what I want to do is include other php files to
> make up my sidebar based on which page I'm calling from. For example,
> I don't want to include a link to our schedule of speakers if that is
> the page that I am on.

why not?


> Would a case statement be the best way to
> handle this?
>
sure - make a generic 'sidebar' file and selectively omit bits of it
depending on a paraetr passed to your 'draw_the_sidebar($for_this_page)
function
> p.s. if not obvious, I'm a php newbie.

with respect, a coding newbie. That's basic coding approach stuff. In
any procedural language.

first of all you learn inline code.

You discover you are writing the same bit over and over.

You invent the macro or the subroutine (function)

You discover you are writing subroutines that are almost the same as
each other.

You invent the subroutine whose behaviour varies according to parameters.

You discover lots of these subroutines can be used by different programs

You invent the library, included or linked or run time linked...
Re: How many PHP calls is too many for one webpage? [message #173495 is a reply to message #173486] Fri, 15 April 2011 20:02 Go to previous messageGo to next message
Peter H. Coffin is currently offline  Peter H. Coffin
Messages: 245
Registered: September 2010
Karma: 0
Senior Member
On Fri, 15 Apr 2011 12:09:16 -0700 (PDT), Evolution wrote:
> On my homepage, I have five 'require_once' calls and within one of
> those, two more 'require_once' calls. I want to increase this from
> those seven to about twelve. This seems like no problem but I'm
> wondering what the most anyone else has tried without any costly
> degradation of load time.

The increase in load time will be entirely lost in comparison to the
amount of time it takes to shove all the bits half-way around the world
to someone's browser.

--
I wish there was a knob on the TV to turn up the intelligence. There's a
knob called "brightness", but it doesn't work.
-- Gallagher
Re: How many PHP calls is too many for one webpage? [message #173497 is a reply to message #173486] Fri, 15 April 2011 21:24 Go to previous messageGo to next message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma: 0
Senior Member
.oO(Evolution)

> On my homepage, I have five 'require_once' calls and within one of
> those, two more 'require_once' calls. I want to increase this from
> those seven to about twelve. This seems like no problem but I'm
> wondering what the most anyone else has tried without any costly
> degradation of load time.

Shouldn't be a problem. In my scripts there can be several dozen classes
be required in order to answer a single page request, all loaded from
separate files. But most of them will be cached, either by the OS or by
a bytecode cache in PHP, so it's not really a problem.

Micha
Re: How many PHP calls is too many for one webpage? [message #173499 is a reply to message #173486] Fri, 15 April 2011 22:08 Go to previous messageGo to next message
Jo Schulze is currently offline  Jo Schulze
Messages: 15
Registered: January 2011
Karma: 0
Junior Member
Evolution wrote:

> On my homepage, I have five 'require_once' calls and within one of
> those, two more 'require_once' calls. I want to increase this from
> those seven to about twelve. This seems like no problem but I'm
> wondering what the most anyone else has tried without any costly
> degradation of load time.

Impossible to answer. require_once or all the other PHP ways to execute
another script is not the point (the statement is pretty cheap), the
important value is how the actions taken in the required scripts scale.
Re: How many PHP calls is too many for one webpage? [message #173500 is a reply to message #173499] Fri, 15 April 2011 23:47 Go to previous messageGo to next message
Evolution is currently offline  Evolution
Messages: 14
Registered: April 2011
Karma: 0
Junior Member
On Apr 15, 3:08 pm, Jo Schulze <antis...@feuersee.de> wrote:
> Evolution wrote:
>> On my homepage, I have five 'require_once' calls and within one of
>> those, two more 'require_once' calls.  I want to increase this from
>> those seven to about twelve.  This seems like no problem but I'm
>> wondering what the most anyone else has tried without any costly
>> degradation of load time.
>
> Impossible to answer. require_once or all the other PHP ways to execute
> another script is not the point (the statement is pretty cheap), the
> important value is how the actions taken in the required scripts scale.

Thanks for your reply (and all others). What would be an example of
poor scaling? Mostly, my php amounts to 'require_once' and a few
calls for "Last modified' date, passing the 'title' and obtaining
today's date. Pretty simple so far.
Re: How many PHP calls is too many for one webpage? [message #173503 is a reply to message #173500] Sat, 16 April 2011 01:17 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 4/15/2011 7:47 PM, Evolution wrote:
> On Apr 15, 3:08 pm, Jo Schulze<antis...@feuersee.de> wrote:
>> Evolution wrote:
>>> On my homepage, I have five 'require_once' calls and within one of
>>> those, two more 'require_once' calls. I want to increase this from
>>> those seven to about twelve. This seems like no problem but I'm
>>> wondering what the most anyone else has tried without any costly
>>> degradation of load time.
>>
>> Impossible to answer. require_once or all the other PHP ways to execute
>> another script is not the point (the statement is pretty cheap), the
>> important value is how the actions taken in the required scripts scale.
>
> Thanks for your reply (and all others). What would be an example of
> poor scaling? Mostly, my php amounts to 'require_once' and a few
> calls for "Last modified' date, passing the 'title' and obtaining
> today's date. Pretty simple so far.

When the server gets too overloaded to handle the requests it the time
to worry about performance. And then you need to look at what's
actually causing the performance problem.

Including or requiring files is going to be one of the least of your
worries.

And being concerned about it when you have no problem is just premature
optimization. Rather, build your code where it is maintainable and
understandable.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How can I serialize zend_http_request object?
Next Topic: Why no Text after image 1?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 14:16:26 GMT 2024

Total time taken to generate the page: 0.02256 seconds