Re: Method call overhead

From: Date: Thu, 04 Jun 2015 04:44:07 +0000
Subject: Re: Method call overhead
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Thu, Jun 4, 2015 at 1:35 PM, Yasuo Ohgaki <[email protected]> wrote:

> On Thu, Jun 4, 2015 at 7:33 AM, Brian Moon <[email protected]> wrote:
>
>> This is a better representation of what you are trying to show. It
>> removes all the magic call back stuff that could be adding to the slowness
>> you are seeing. In addition, it does not create a new object on every call
>> for the object method. Creating a new object is going to explicitly slow
>> things down. But, it's not related to the call time.
>>
>> http://3v4l.org/biM9G
>>
>
> This version adds up precision errors because microtime() precision is not
> high enough for
> the purpose. Since the error is random, it does not affect proportion much
> but total
> execution time. Following damn code does better job for these kinds of
> benchmarks.
>
> http://3v4l.org/eJK07
>
> See the total amount of execution time recorded.
> If we really need pure execution time, then it should record "for loop"
> execution time
> with empty body.
>

One additional note.
Even when "for loop" execution time is subtracted, we still have to take
into the return
value handling time to be precise. Since "for loop" and "return value"
handling is constant
time, increasing the number of iterations and ignoring the time is easier.

Regards,

--
Yasuo Ohgaki
[email protected]


Thread (12 messages)

« previous php.internals (#86483) next »