Re: [SMARTY-DEV] Smarty compiler

From: Date: Wed, 06 Nov 2002 02:44:21 +0000
Subject: Re: [SMARTY-DEV] Smarty compiler
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-318@lists.php.net to get a copy of this message
Gary Loescher wrote:
Yup, I definitely think an executable-producing compiler would be detrimental to Smarty. Zend byte code is an interesting idea, didn't think of that. We already have byte code, it is called an accelerator. They already exist, there are free ones available, and that's the original reason for Smarty generating php code, so it can take advantage of something like this. Oh, and they're written with a "real" compiler, so they're already quite fast ;-)
The overhead of regular expressions isn't such a big issue, it only does this at compile time. I see many drawbacks with a compiled solution, some already mentioned. One other would be the ability for everyone to contribute plugins/patches, etc. I'm sure there are a lot more php-savvy users than there are C-savvy, and we'd be cutting our own throats by limiting who can contribute. I don't think the gains in speed (if any) would outweigh the drawbacks. It's already damn fast anyways, what's the problem? ;-) Monte
I think the issue is this: should we develop a PHP-based LALR(1) parser that understands a real grammar and can produce PHP code, then somehow shoehorn the Smarty syntax into the grammar? There might be a performance gain by not using regular expressions and logic for the parsing, but I have no idea how big it might be. It's kind of a chicken-and-egg problem. We won't know if the performance gain is enough to warrant an implentation until we implement it and benchmark. :P Maybe we should consider a compiler rewrite that avoids regexs, and lose the LALR(1) component. Gary
-----Original Message----- From: David M. Patterson [mailto:dpatterson4@cox.net] Sent: Tuesday, November 05, 2002 7:25 PM To: gary@loescher.org Subject: RE: [SMARTY-DEV] Smarty compiler For whatever it's worth, here is my 2-cents worth. Personally, I think that turning Smarty into a "real" compiler is not a particularly good idea. Interesting, but not good. One of the really great things about Smarty is that it is based on PHP and PHP, in turn, runs on almost every platform. I do all of my development on Windows-2000 boxes using Apache and deploy to both Linux and Windows servers without having to do anything to my code. A "real" compiler would, by definition, create system- specific code, most likely even platform specific. This means that to get the same functionality we have now, we would have to have a Smarty compiler version for each platform/OS combination. On top of that, I don't know that you'd really get enough of a performance increase to make the effort worth while. I'm using PHP4 with Apache 1.3.23 and mySQL and have never had a performance problem. And, from what I've been reading, Apache 2 includes some
significant performance improvements in it. Of course, I could be way off base here in my interpretation of the the term "real compiler". If you're actually talking about something that generates byte-code and a run-time interpreter (Apache module?) to go with it, that might be a different story. Or, if you're talking about something that would generate PHP byte code (is that what Zend calls it) and is compatible with their optimizer and that ilk, that would also be interesting. Still though, not sure if it would be worth the effort. Just my opinion. No flames please. Dave
-----Original Message----- From: Gary Loescher [mailto:gary@loescher.org] Sent: Tuesday, November 05, 2002 5:11 PM To: 'Brandon Inman'; smarty-dev@lists.php.net Subject: RE: [SMARTY-DEV] Smarty compiler I sent a post a day or so ago about this, didn't get any bites :) Here are some questions to start discussion: 1) What does Smarty get out of it? 2) What do end users get out of it? 3) What do developers get out of it? 4) In other words, why is a 'real' compiler an improvement? 5) Can it be done without breaking backward compatibility, given current Smarty syntax? 6) If backward compatibility can't be maintained, is it time for a branch given the benefits? (Don't flame me, just posing the question :) 7) What are some other other pros and cons?
     
-----Original Message----- From: Brandon Inman [mailto:brinman2002@yahoo.com] Sent: Tuesday, November 05, 2002 6:38 PM To: smarty-dev@lists.php.net Subject: [SMARTY-DEV] Smarty compiler Recently, someone threw out the suggestion of rewriting Smarty as a 'real' compiler. I think this is a good idea. Is anyone else out there interested in doing this? If no one is interested in doing this, let me know what else is out there. I'd like to get involved in some fashion. Brandon Inman __________________________________________________ Do you Yahoo!? HotJobs - Search new jobs daily now http://hotjobs.yahoo.com/ -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
       
-- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
     


« previous php.smarty.dev (#318) next »