Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

PHPEverywhere:
Pros and Cons of Extensions
Mar 05, 2003 @ 13:04:01

Over on PHPEverywhere this morning, there's a new posting that follows the lead of some of the previous postings on here. Moving code to a PHP extension can have some interesting effects, both good and bad.

Well the interesting question to ask is: what's the speedup. Not much actually. The overhead of the PHP classes in ADOdb (compared to native mysql calls) is about 25-30%. Converting to C reduces the overhead to about 15%. It is possible to convert more of the PHP code to C, but the loss in flexibility is probably not worth it.

Now, obviously, this all depends on what kind of application you're writing in the extension, and what kinds of "gotchas" you'll need to be aware of. In fact, I found this pretty startling: Unfortunately it appears that I cannot make use of this extension 100% transparent to the user. I thought of embedding adodb_movenext() in the MoveNext() function, and automatically switching between PHP and C code based on the extensions loaded. It turns out that the autodetection code causes the newly boosted MoveNext() to run slower than the plain old PHP version. Caveat emptor!

tagged:

Link:


Trending Topics: