Jump to content

check function speeds


marm

Recommended Posts

If you can't find a webpage you can do it yourself using microtime() ie

 

$time_start = microtime(true);

//Do some stuff...

$time_end = microtime(true);
$time = $time_end - $time_start;

echo "Stuff took $time seconds";

 

(ps - this was yoinked off php.net)

Link to comment
Share on other sites

Ok, but if you those scripts, the results vary: you press "refresh" in your browser and you can get a totally different answer. And the order in which you use the functions inside those scripts also make the results vary. How can I get an "unbiased" result?

Link to comment
Share on other sites

Its interesting to point out that:

 

bin2hex(mhash(MHASH_SHA1("whatever")));

 

takes nearly double the time than:

 

sha1("whatever");

 

Can other hashes be "built into php" like sha1 is?

Link to comment
Share on other sites

hash('md5', 'string');

 

returns: Fatal error: Call to undefined function: hash()

 

bin2hex(md5('string', TRUE));

 

returns: Warning: Wrong parameter count for md5()

 

(these errors happen in PHP4 since they were added in PHP5)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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