Re: php compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Barnett wrote:
Jay Blanchard wrote:

[snip]
Sooo.. I'm assuming there's no stable project for compiling php code to
native binary machine code huh?  (I've done some searching)  Even
anything commercial? (I didn't care for Zend's optimizer so much.. still

has *RUN*time configuration)
[/snip]

http://www.priadoblender.com ?

It's a little messy on Windows, or at least it was for me. On my Win2000 box I have had a few issues:

- The gui controls are a little buggy
- Installation led to a lot of files being installed in locations not in
my control (some of the files even were put into root!)

I really like the idea, but I'm going to hold off on using pb until it's
a bit more stable.  Besides, most of my command line scripts aren't so
intensive that I really need to compile the code into native machine code.

In the end you are probably much better off learning a bit of C or C++ and writing your own PHP extensions than hoping that someone will make a compiler that will magically speed everything up. PHP was designed specifically with this in mind. The idea is to keep things that don't need native code performance in easy to modify interpreted files while performance-sensitive code is written in fast native code.


That is, if you have a script that queries a database and outputs some HTML, whether you send that SQL query and print the resulting strings from PHP or native code is not going to matter one bit. Your bottleneck is going to be building the query, connecting to the database server, the database server chewing on the query and sending the results back over the wire and your application reading that socket and deciphering the results. All those bits are written in C. It would be crazy to try to implement the MySQL extension or MySQL itself in user-space PHP. It could be done of course, but when you build something you identify the performance-critical bits of code and you write those bits natively.

We are at the point where most people don't need to write any C code to write fast PHP applications because other people have already written the native extensions you need. But high-traffic sites or sites that need a lot of iterative logic should try profiling their code to see where the bottlenecks are and replace the critical bits with a native extension. That is likely going to give you an order of magnitude better performance than any "PHP Compiler" ever will. And it really isn't that hard to write a PHP extension.

-Rasmus

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux