Click to See Complete Forum and Search --> : php benchmarking


nrg_alpha
06-29-2008, 12:40 AM
Hey guys.. it's been a while since I posted last.

I stumbled upon a php benchmark site that I personally found interesting. Nice to see some gauging of certain functions to see which is faster..

Not sure if the site has been posted here before.. I did a search across forums for it but found nothing..

In any case, here is the site:

http://www.phpbench.com/

If there are any other simular benchmark sites regarding php that you know of, I would be interested in seeing them. While some of the comparisons are marginal, as programmers, I think that getting to know the 'fastest' route to accomplishing a task never hurts (fastest as in being aboe to choose which method requires the leats amount of CPU usage).

Cheers,

NRG

laserlight
06-29-2008, 02:12 PM
While some of the comparisons are marginal
Yes. Also, it is not true that "isSet() and empty() are identical" (even allowing for them being identical in the sense that one is the negation of the other), nor is it literally true that "in reality the echo and print functions serve the exact purpose and therefore in the backend the exact same code applies" (though the author clearly intended to say that they are typically used in the same way, thus there is no advantage to using print over echo unless you happen to want to use the fact that print returns a value).

While some of the comparisons are marginal, as programmers, I think that getting to know the 'fastest' route to accomplishing a task never hurts
The 'fastest' route may also change between versions of PHP, as the author of that benchmark website has hinted.

nrg_alpha
06-29-2008, 03:43 PM
nor is it literally true that "in reality the echo and print functions serve the exact purpose and therefore in the backend the exact same code applies" (though the author clearly intended to say that they are typically used in the same way, thus there is no advantage to using print over echo unless you happen to want to use the fact that print returns a value).

Thanks for the heads up, laserlight!

But I am rather curious as to print returning a value (which I was not aware).. which value is this? How can I test this in code? On the surface, indeed echo and print seem to accomplish the same task.

I am going to hazzard a guess in that the returned value for print is too small of value / CPU usage to be concered with?

Cheers,

NRG

bradgrafelman
06-29-2008, 05:52 PM
print():

Return Values

Returns 1, always.

Weedpacket
06-29-2008, 06:37 PM
Returns 1, always....so that it can be used in places where an expression - which by definition is supposed to have a value - is expected.

nrg_alpha
06-29-2008, 08:05 PM
Thanks Brad and Weed.

I gotta start reading the php manual more often. :rolleyes:

Cheers,

NRG