[PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-05 Thread Jeff Moore
I remember a discussion about system calls here earlier. What is the status of that? I've been doing some tests and have found that this code runs about 2.5 times slower under 4.3.2 than it did on 4.1.2 on the same machine (running OS X): I did some tests with fs_usage to check file system c

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-05 Thread Rasmus Lerdorf
Uh, the number of open() calls really shouldn't change. Are you sure you are comparing the same code? And how are you testing? Attach strace or truss to your running httpd process and hit your script a single time. Then look at the output and compare them. Some of the keys to reducing syscalls:

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-05 Thread Ilia A.
Here is an analysis of the situation as it stands with PHP 4.3.3. As far as I can tell that even when opening files with the full path we do a lot of completely unnecessary work. We start from expand_filepath() which, gets called when opening a file. This function does a getcwd() everytime it i

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-05 Thread Brian J. France
I believe those are from the realpath call. It splits the path and stats each part to make sure it is real: 1) / 2) /home 3) /home/rei 4) /home/rei/PHP_CVS 5) /home/rei/PHP_CVS/STABLE 6) /home/rei/PHP_CVS/STABLE/php4 Brian On Wed, 4 Jun 2003 13:27:14 -0400, Ilia A. wrote: > Now, the interestin

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-05 Thread Rasmus Lerdorf
On Wed, 4 Jun 2003, Ilia A. wrote: > Here is an analysis of the situation as it stands with PHP 4.3.3. As far as I > can tell that even when opening files with the full path we do a lot of > completely unnecessary work. > > We start from expand_filepath() which, gets called when opening a file. Thi

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-05 Thread Jeff Moore
On Wednesday, June 4, 2003, at 12:21 PM, Rasmus Lerdorf wrote: Uh, the number of open() calls really shouldn't change. Are you sure you are comparing the same code? Yes. I am sure. And how are you testing? I attach fs_usage to the running httpd process and hit the script a single time. ht

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-05 Thread Rasmus Lerdorf
Oh, this is on OSX? I guess realpath() does an open() on every component of a path on OSX? That's nuts! -Rasmus On Wed, 4 Jun 2003, Jeff Moore wrote: > > On Wednesday, June 4, 2003, at 12:21 PM, Rasmus Lerdorf wrote: > > > Uh, the number of open() calls really shouldn't change. Are you sure

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-09 Thread Andi Gutmans
At 01:27 PM 6/4/2003 -0400, Ilia A. wrote: Here is an analysis of the situation as it stands with PHP 4.3.3. As far as I can tell that even when opening files with the full path we do a lot of completely unnecessary work. We start from expand_filepath() which, gets called when opening a file. This

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-09 Thread George Schlossnagle
On Monday, June 9, 2003, at 12:58 PM, Andi Gutmans wrote: At 01:27 PM 6/4/2003 -0400, Ilia A. wrote: Here is an analysis of the situation as it stands with PHP 4.3.3. As far as I can tell that even when opening files with the full path we do a lot of completely unnecessary work. We start from

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-10 Thread Ilia A.
There are a several things that could be done to speed file opening process up. Attached is a fairly simple patch that in most cases optimizes potentially expensive code that looks for ../ and ./ in the path. Ilia Index: TSRM/tsrm_virtual_cwd.c =

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-10 Thread Ilia A.
On June 9, 2003 12:58 pm, Andi Gutmans wrote: > At 01:27 PM 6/4/2003 -0400, Ilia A. wrote: > >Here is an analysis of the situation as it stands with PHP 4.3.3. As far > > as I can tell that even when opening files with the full path we do a lot > > of completely unnecessary work. > > > >We start fr

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-10 Thread Rasmus Lerdorf
On Tue, 10 Jun 2003, Ilia A. wrote: > As far as realpath() goes beyond the _once() directives and php installations > where safe_mode or open_basedir are enabled it is not really needed. To > handle safe_mode/open_basedir is fairly easy and mostly involves passing > TSRMLS_CC to virtual_file_ex() a

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-10 Thread Andi Gutmans
At 09:51 PM 6/10/2003 -0400, Ilia A. wrote: There are a several things that could be done to speed file opening process up. Attached is a fairly simple patch that in most cases optimizes potentially expensive code that looks for ../ and ./ in the path. This sounds like a weird patch to me. How many

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-10 Thread Andi Gutmans
At 06:55 PM 6/10/2003 -0700, Rasmus Lerdorf wrote: On Tue, 10 Jun 2003, Ilia A. wrote: > As far as realpath() goes beyond the _once() directives and php installations > where safe_mode or open_basedir are enabled it is not really needed. To > handle safe_mode/open_basedir is fairly easy and mostly

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-10 Thread Andi Gutmans
At 07:15 AM 6/11/2003 +0300, Andi Gutmans wrote: At 09:51 PM 6/10/2003 -0400, Ilia A. wrote: There are a several things that could be done to speed file opening process up. Attached is a fairly simple patch that in most cases optimizes potentially expensive code that looks for ../ and ./ in the pat

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-10 Thread Ilia A.
Well, judging from my own experience, most people do either a full path include, or a relative path include from the current directory such as a/b/c.php and similar. So for these cases we can bypass tokenizing the patch at an fairly light cost of 2 memchr() calls. The realpath may alleviate the

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-10 Thread Andi Gutmans
At 12:52 AM 6/11/2003 -0400, Ilia A. wrote: Well, judging from my own experience, most people do either a full path include, or a relative path include from the current directory such as a/b/c.php and similar. So for these cases we can bypass tokenizing the patch at an fairly light cost of 2 memchr

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-11 Thread Thomas Seifert
On Wed, 11 Jun 2003 07:49:24 +0300 [EMAIL PROTECTED] (Andi Gutmans) wrote: > It's really quite simple. Make a hash that holds a structure which has the > realpath() and time of entry in it. If it's still relevant use it. If you > want to limit the hash to X entries (no need IMO) the easy way is

Re: [PHP-DEV] Benchmarking 4.3.2 vs 4.1.2

2003-06-11 Thread Andi Gutmans
At 12:14 AM 6/12/2003 +, Thomas Seifert wrote: On Wed, 11 Jun 2003 07:49:24 +0300 [EMAIL PROTECTED] (Andi Gutmans) wrote: > It's really quite simple. Make a hash that holds a structure which has the > realpath() and time of entry in it. If it's still relevant use it. If you > want to limit the