[xdebug-general] many iterations and

From: Sencer <alisencer[@]gmail.com>
Date: Wed, 27 Apr 2005 05:44:32 -0700

Hi,

I noticed something that I am not sure how to interpret. Maybe someone
here can help me.
While I was profiling a software (textpattern), it showed a certain
loop to be responsible for ~12% of the execution. Within the loop the
code would read a file line by line (with fgets), trimm, explode and
assign the values in an array.

I rewrote the code to generate a php-file with all the assignments
that would simply be included. So the new code would include a file,
with a lot of assignments.

Sure enough, xdebug showed that the new code used less than 1% of
execution time.

However when running ab to test the generation time (around 200 ms on
my system) there was no difference between the old code and the new
code. To exlude the influence of apache-related stuff, I ran the
script through the CLI php binary ( time for x in $(seq 1 30); do php
./index.php > /dev/null ;done ), but with the same results: With the
old code and new code there was no difference. But when I enabled the
xdebug-extension again, there was a reproducable difference between
old code and new code.

From my layman's (with respect to how xdebug actually works) POV it
seems as if xdebug itself is introducing a minimal overhead for each
executed statement which especially for very "cheap" statements is
considerable enough that it can skew results if those statements are
iterated-over very many times.
Another indication that would support this, is that when I compared
two different software, packages the _relative_ difference between the
two as measured by xdebug would be worse for the software that had
(considerably) more NCLOC [the trace-file would be 2-3 times as big]
with respect to the relative difference as measured by cli/ab. (With
that sentence I probably lost the last person that was still following
through...;) )

Am I wrong, because I overlooked sth.? Or was this already fairly
obvious for anybody else? Should I provide more data so other can
reproduce and investigate?

[btw: I was using 2.0.0beta binaries for windows with php4.3.10]

Regards

Sencer

-- 
http://www.sencer.de
Received on Wed Apr 27 2005 - 14:47:23 BST

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST