Page 1 of 1

Optimizer in the PHP parser ??

Posted: Mon Jan 27, 2003 5:17 am
by Heavy
This post is about how the PHP parser handles includes and concatenation of strings.

I'm posting it because I know that ASP for IIS (I'm not talking about ASP.NET) has a very slow behaviour when concatenating strings and compiling ASP-pages using server side includes, SSI.

First:
Every time the ASP engine runs across a SSI-tag. It takes a note and starts compilation over again.
Thus, when having four includes the ASP-page is parsed five times before beeing ready to run.

How does the PHP parser handle includes?
I guess this isn't really a concern for those who use PHP Accelerator, since the compilation of a page is cached in such a system.

Second:
Everytime th ASP engine runs across an ampersand between two strings in an ASP-page, it moves the entire original string memory block to another place where the concatenation actually happens. I guess this has something to do with avoiding fragmentation and memory linearity.

How does the PHP parser handle string concatenation?

Posted: Mon Jan 27, 2003 8:53 am
by Stoker
This is not the answer to your question, as I have never studied the PHP intepreter in details.. You may want to use an IRC client and head for irc.freenode.net and channel #PHP, many of the PHP/extension devs visit there quite often..

This is not really related; about a year ago I ran some file-access efficiency tests, back then someone claimed relative file-paths where faster than absolute paths (that proved opposite and insignificant), the interresting part is how fast PHP read and included files. I had 1 file including 100 other files, which in turn included 100 files each, a total of 10000 individual files include-processed (just a few lines of code in each), on an old 486-DX2-66/IDE/16MB/Ext2 this took 87 seconds (The PHP script that created the 10000 files took 52 seconds on that machine), on a Dual P3-1Ghz/1GBram/SCSI/Ext3 the processing of those 10K files took 1.2 seconds.. I wouldn't expect anything near that performance on a Bill Gates machine, never tried tho..

Posted: Tue Jan 28, 2003 3:09 am
by Heavy
How does the PHP parser handle string concatenation?
I realize that's got to depend on which system the PHP parser is running on.
Maybe Linux memory management is more effective than windows when it comes to changing the size of an allocated memory block.

??? :roll: :?: