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

Home » FUDforum Development » Bug Reports » Total time taken to generate the page
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Total time taken to generate the page [message #19214] Fri, 02 July 2004 08:46 Go to next message
djnz is currently offline  djnz   United Kingdom
Messages: 14
Registered: July 2004
Karma: 0
Junior Member
There are always problems with template engines and time displays, but with FUDforum this seems to be quite extreme. If you put a timer outside FUDforum the overall execution time on my server seems to be consistently 0.007s greater than displayed by FUDforum. Now this is not a lot in absolute terms, but with typical times displayed by FUDforum less than 0.01s it is relatively high.
Re: Total time taken to generate the page [message #19219 is a reply to message #19214] Fri, 02 July 2004 12:38 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
That's because you end up timing how long it takes for the user to receive the page.

FUDforum Core Developer
Re: Total time taken to generate the page [message #19225 is a reply to message #19219] Fri, 02 July 2004 13:41 Go to previous messageGo to next message
djnz is currently offline  djnz   United Kingdom
Messages: 14
Registered: July 2004
Karma: 0
Junior Member
Not so. Create the following file as _index.php and see what happens.
ob_start();
define('_START', microtime());
include 'index.php';
define('_FINISH', microtime());
list($secs, $usecs) = explode(' ', _START);
$start = $secs + $usecs;
list($secs, $usecs) = explode(' ', _FINISH);
$finish = $secs + $usecs;
$time = $finish - $start;
$page = ob_get_clean();
echo "It took $time seconds to generate this page";
$echo $page;

Re: Total time taken to generate the page [message #19228 is a reply to message #19225] Fri, 02 July 2004 13:46 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
You are still timing how long it takes to stick the page into a buffer. You are also timing how long it takes to parse & load index.php into memory as well as all of the files it includes.

FUDforum Core Developer
Re: Total time taken to generate the page [message #19231 is a reply to message #19228] Fri, 02 July 2004 13:57 Go to previous messageGo to next message
djnz is currently offline  djnz   United Kingdom
Messages: 14
Registered: July 2004
Karma: 0
Junior Member
Er, yes. The display in FUDforum says Total time taken to generate the page: 0.03331 seconds. Surely that should include the time to load the code that generates the page? And to stream the page to the output buffer as it is generated? How else can you define the total time to generate the page?


Re: Total time taken to generate the page [message #19232 is a reply to message #19231] Fri, 02 July 2004 14:12 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The time taken to generate the page is how long it took for the forum code to generate the given output. The time taken to buffer or send the output to the user does not count nor does the time taken for PHP to parse the scripts. The latter becomes irrelevant anyway with a opcode caching system. The former may be included inside in the timings anyway if you use the forum's .htaccess files that will force buffering of most pages in memory before being sent to the user.

0.007 is a very small number indeed just looking at your code you have 2 defines (slow), 2 timing calls and 1 realpath (very slow) and then of course parsing of index.php itself. This can easily cover 0.00[3-4].


FUDforum Core Developer
Re: Total time taken to generate the page [message #19244 is a reply to message #19232] Fri, 02 July 2004 21:42 Go to previous messageGo to next message
djnz is currently offline  djnz   United Kingdom
Messages: 14
Registered: July 2004
Karma: 0
Junior Member
I understand now - thanks for taking the time (!) to explain how you view script execution time.

What I should have said up front was that, which ever way you look at it, FUDforum is incredibly fast. One day I will make the effort to understand exactly how you have achieved that. For the moment, I am busy working on integrating FUDforum into a couple of sites.

You will be disappointed to hear that I haven't got around to looking at FUDforum templates yet, so to integrate the display in my site I am parsing the whole buffered FUDforum output through a preg_match and reassembling head and body with my own HTML to achieve a clean-looking and valid HTML page. This is a lot quicker than you might think and the whole thing still runs in 0.05s or so (from the first line of the first script to near the end of output streaming), which is a lot better than the same site was achieving with postnuke/PNphpBB2 (0.4s).
Re: Total time taken to generate the page [message #19468 is a reply to message #19232] Thu, 22 July 2004 08:35 Go to previous messageGo to next message
djnz is currently offline  djnz   United Kingdom
Messages: 14
Registered: July 2004
Karma: 0
Junior Member
I have now done some timing tests and on my set-up the 'missing' time is parsing index.php/globals.php/core.inc which is taking consistently 0.006s. An interesting exercise for me demonstrating (i) if you want accurate timings don't set a timer at the beginning of a big file (ii) if you want to speed things up, don't bother optimising anything until you have installed a compiler.
Re: Total time taken to generate the page [message #19471 is a reply to message #19468] Thu, 22 July 2004 18:29 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
The parsing of PHP files is a tricky as far as time goes. The primary thing is that this depends on your drive speed unless you use an opcode cache. If and when opcode cache is used parsing a file becomes a very very fast process. Testing the speed of the script from within itself is a very unprecise process unless you isolate a bit of code, put it into a very long loop and time it. This will ensure that random effects and parsing times are averaged out.

FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Moderator Queue showing up empty
Next Topic: No Smileys If You Edit An Existing Message - 2.6.5RC2
Goto Forum:
  

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

Current Time: Fri Sep 20 02:39:54 GMT 2024

Total time taken to generate the page: 0.02639 seconds