Re: Function caching...
| From: | Zeev Suraski | Date: | Tue, 12 Dec 2000 12:49:56 +0000 |
| Subject: | Re: Function caching... | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-40965@lists.php.net to get a copy of this message | ||
At 14:34 12/12/2000, Ulf Wendel wrote:
Note that this comes at a price. It comes at a price of relying on the static nature of your data structures, something which is usually not Maybe there's a misunderstanding here. If my objects were persistant within requests I would not need to rebuild them and fill them with session and HTTP request data over and over again. Once I have initialized my data structures using XML they dynamically change between requests.Persistent objects (for which you would use sessions today) is one thing. Caching the return values of functions is another, much more dangerous thing, and as I said, it comes with a price.
Scaling by hardware is a very bad thing. It's not possible to use for every middle-sized web application a dedicated machine. If that's the future we have to switch from PHP to other solution which is not what we want as we love PHP.I disagree, especially as we're not talking about scaling. As a matter of fact, you disagree as well, you just didn't notice it. You write your applications in PHP and SQL. Undoubtfully, if you wrote your applications in Assembley or in C, using specialized databases, you could end up with much more efficient results, orders of magnitude faster. But since you haven't gone crazy, you don't do this, and instead, pick a scripting language which cuts your development time considerably, and use a standard SQL database, which makes data storage much easier and easier to develop. Both of those also significantly reduce the chances of there being a bug in your code, since lots of the dirty work is being done by the scripting language and the database. Now, this comes at a price. You're paying this price on a minutely basis every day, because your existing hardware can only serve X requests per second due to your usage of PHP and SQL, instead of 5X or 10X requests per second, if you were using Assembley and a specialized data storage. No doubt, your method will save execution time. But like any other methods of cutting down on execution time (like the ones mentioned above), it comes in a price. It may reduce the ease of use, it may make your application less stable and more prone to bugs, and it may harm it otherwise. It's the most basic rule of computer science - it's one big world of tradeoffs. Zeev -- Zeev Suraski <zeev@zend.com> CTO, Zend Technologies Ltd. http://www.zend.com/