include php can slow webpage downloading?

Discussion in 'PHP' started by onlineq, Jan 31, 2005.

  1. #1
    Since I have large websites, I would like to use "include php" for future updating my sites easily and fast. I test to include serveral php in my .html sites, I found that webpage downloading become slow.

    Is that normal or can I have some way to modify, then won't affect webpage download ?

    Thanks for your input,
    HG
     
    onlineq, Jan 31, 2005 IP
  2. DangerMouse

    DangerMouse Peon

    Messages:
    275
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Using Server side scripting will always slow you down... Sorry ;)

    Your server has to process the code on the page before sending the html
     
    DangerMouse, Jan 31, 2005 IP
  3. xml

    xml Peon

    Messages:
    254
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hmm, it shouldn't make any noticeable effect to download times.

    Is there much PHP code in the includes? Does this code require much CPU usage?
     
    xml, Jan 31, 2005 IP
  4. eduardomaio

    eduardomaio Peon

    Messages:
    450
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Normally the waiting time increases only a millisecond or two... Of course that depends on what kind of website, includes, sql queries, etc etc etc...
     
    eduardomaio, Jan 31, 2005 IP
  5. daboss

    daboss Guest

    Messages:
    2,249
    Likes Received:
    151
    Best Answers:
    0
    Trophy Points:
    0
    #5
    i would not think that using 'includes' would be noticably slower. in fact, if the same pieace of code gets use in many places, i would think using 'includes' is encouraged to make your code more manageable. even if you 'includes' contain code that performs a task (e.g. querying a database), actually putting the code into the main php file would also cause the slowdown...

    and by the way, 'includes' could include scripts that perform some server side processing, but 'includes' is not equal to server side scripting...
     
    daboss, Jan 31, 2005 IP
  6. nevetS

    nevetS Evolving Dragon

    Messages:
    2,544
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    135
    #6
    just using an include shouldn't affect your speed much if at all. The CPU time needed to process that is miniscule. You might look to what you are including... database access, large piece of code, giant file etc. will slow things down, but a simple include affects things very little.
     
    nevetS, Jan 31, 2005 IP
  7. fsolm1

    fsolm1 Member

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #7
    Much agreed, the time it takes to parse things server side is extremley fast. As stated, large databases and stuff like that might slow it down considerably. All in all, it shouldn't be bad. Why, do you notice a lag? Show a url and i'll test it and let you know if it is slow on my end too.
     
    fsolm1, Jan 31, 2005 IP
  8. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #8
    A plain text include takes less than a millisecond to execute, even on an average machine. Most properly designed simple DBMS queries will execute in 5 ms or less. If you see noticeable slowdown, there's something wrong with your setup.

    J.D.
     
    J.D., Jan 31, 2005 IP
  9. DangerMouse

    DangerMouse Peon

    Messages:
    275
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #9
    The man asked about "include php" - I guess we can assume it's gonna take some server side :p
     
    DangerMouse, Jan 31, 2005 IP
  10. Old Welsh Guy

    Old Welsh Guy Notable Member

    Messages:
    2,699
    Likes Received:
    291
    Best Answers:
    0
    Trophy Points:
    205
    #10
    I think there is some confusion here over people who use WYSIWYG editors and people who understand scripting. Obviously a php include is a server side script, but Frontpage also now writes includes that are also server side, you just don't have to understand them any longer as it is all automated.

    As has been posted here, as server side script if it is a simple include of a navigation structure etc should not slow down the page load by any noticable volume. Even if it is pulling information dynamically, it should not slow the page down any more than the original hard coded dynamic request would have. maybe a little more information about the funtion of the include would clear the muddy waters .
     
    Old Welsh Guy, Jan 31, 2005 IP
  11. onlineq

    onlineq Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Thanks for all response. Really appreciate.

    I add 6 "include php" scripts into .html webpages. All php scripts are pretty simple php. Two of them try to dynamically retrieve content on the net, small size, not heavy content. Rest of php scripts just simply retrieve my html page's content.

    I did some test again. Slow downloading is not all the time, might related to server, my computer, traffic hours, etc.

    I am afraid to slow webpage downloading if I add more include php scripts?

    Thanks

    HG
     
    onlineq, Jan 31, 2005 IP
  12. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Get two time stamps, one at the beginning of the page and one at the end of the page and output the difference (in milliseconds or microseconds). This will give you a pretty good idea of how fast (or slow) your includes are.

    J.D.
     
    J.D., Jan 31, 2005 IP
  13. Help Desk

    Help Desk Well-Known Member

    Messages:
    1,365
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    180
    #13
    I agree with the common thought. It's not that you are "including" that is slowing you down. It's what you "including" that is slowing you down.
     
    Help Desk, Feb 1, 2005 IP
  14. mushroom

    mushroom Peon

    Messages:
    369
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #14
    That will slow things down for sure.

    Consider storing them in a data base with a timestamp and only retrieve new copies if the timestamp is more than an hour or two old.
     
    mushroom, Feb 1, 2005 IP
  15. gullam18

    gullam18 Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    hi,
    i think that 'include' wont make page download time slow (may be in milli secs).
    bcoz the program is getting include file from its own hard drive, but it may depend upon the size and process...

    --------------
    gullam18
    Powering web hosting company in india.
     
    gullam18, Feb 6, 2005 IP
  16. nevetS

    nevetS Evolving Dragon

    Messages:
    2,544
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    135
    #16
    They could very well be slow because they are trying to retrieve content from elsewhere. 1) you have no idea what your outbound bandwidth is. It could be limited, or there could be hundreds of scripts doing the same thing on your server.
    2) you are relying on the speed of the server you are retrieving content from. Many servers are set up to only allow two sessions at a time from a single IP to prevent a single user from bogging down there server by downloading things.
     
    nevetS, Feb 6, 2005 IP
  17. rapaman

    rapaman Active Member

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #17
    hi,

    you have in that includes mysql requests or queries ?

    Best Regards,
    Dmitry.
     
    rapaman, Feb 7, 2005 IP
  18. rajeev_seo

    rajeev_seo Peon

    Messages:
    211
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    include function not effect on speed dont vury its safe


    best regards
    deepak chauhan
     
    rajeev_seo, Apr 24, 2011 IP