Thursday, July 01, 2004

"Lazy" PHP

I was interested to read about the extreme laziness of php today. In contrast with other frameworks like J2EE (and presumably ASP.NET), it throws out EVERYTHING after every request - variables, interpreted code, the lot. One would then presume that a framework like J2EE, which has the compiled bytecode all ready to go (and probably some request-relevant information cached) should serve an individual request quicker. However, the apparent benefit to PHP then is that it scales better, as there are simply no memory issues.

My experience is that PHP serves requests very quickly - even with the source code parsing, it's lightning-quick. However, this angle on PHP suggests obvious ways to improve performance further, such as avoiding the unnecessary interpretation of code (e.g. don't import utility libraries needlessly).

Update:
Although PHP does "start afresh" with each new request, it's worth bearing in mind that PHP now supports server-based session management. This naturally requires memory on the server, so if this feature is used by the developer, one should expect to see scaling issues more in line with other server-side technology.

0 Comments:

Post a Comment

<< Home