Jump to content

Timing?


davej

Recommended Posts

This is Php version 5.2.x. I put this as the first line of the file...

<?php $phptime1 = microtime(true); ?>

...and as my last lines of code that would be executed...

$phpelap = microtime(true) - $phptime1;echo "php-elapsed: <span class='php'>{$phpelap}</span>";

So I guess I need to change that to (microtime(true) - $phptime1)*1000 to get milliseconds?

 

What are typical Php execution times for ordinary pages?

Edited by davej
Link to comment
Share on other sites

That is in microseconds, so yes you need to multiply by 1000 if you want milliseconds.

 

What are typical Php execution times for ordinary pages?
There's no such thing as "typical execution time" or an "ordinary page". Code will execute at different speeds on different hardware under different loads. Database-heavy code or code that does disk I/O will require more time than code that only uses the CPU and RAM. A 16-core Xeon CPU will do work faster than a single-core Pentium-4. A solid state hard drive will respond faster than a spindle drive, etc. You can run benchmarks on a particular server, but that server should be offline if you're trying to do any meaningful comparison. Testing on a server that is already doing a lot of other work doesn't really test the code you're testing, it's testing the entire workload of the server.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...