Jump to content

Includes


johnnyk

Recommended Posts

Yes it will slow down the server some because of the extra script it has to read. But it shouldn't slow it down much if your include file is small. I don't know exactly how much it would slow it down. You would need to run a benchmark on your server to see exactly how much it does slow it down. Just guessing, an include file under 100Kb should be no problem.
Link to comment
https://forums.phpfreaks.com/topic/12185-includes/#findComment-46427
Share on other sites

You probably wont even notice the difference if the file you was including was 10Kb, 100Kb or 1000Kb in size you'll see very little perfomance drop.

It most probably increase your page load by 0.01 secounds or even less. PHP is very fast at processing. You can test how long it may take by doing a quick time trial like so:
[code]<?php

$starttime = microtime();
$startarray = explode(" ", $starttime);
$starttime = $startarray[1] + $startarray[0];

include 'filename.php';

$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = round($endtime - $starttime, 6);

echo '<br /><br />This page loaded in ' . $totaltime . ' seconds';

?>[/code]
The bit that take PHP tine will be how long it takes for PHP to run your function.
Link to comment
https://forums.phpfreaks.com/topic/12185-includes/#findComment-46621
Share on other sites

If you are not using the ZEND php system and the php has then to recompile every time the page is called, then adding a lot of unneeded functions at the beginning of every page might slow down the page quite a bit. It has been my experience that if you have a php page of any complexity at all, that it takes longer for the server to compile the page then it will then take to execute it! I have found that if you move your php code from a non ZEND system to the ZEND php system, you can expect around a 1.5 to 2 second speedup of your pages! (ZEND rocks!) I in no way work for ZEND.

If you are currently using the ZEND php system, then adding the extra php functions to the beginning of every page should not slow it down because if the functions were already compiled earlier but are not executed in the current page, then they will not slow it down significantly.
Link to comment
https://forums.phpfreaks.com/topic/12185-includes/#findComment-47005
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.