Hey everybody,
Some time ago, I coded an HTML template engine that runs under mod_perl that allows a mod_perl application to parse variables, simple conditionals, and nested include files in an HTML file read from disk (or from my module's very quick memory cache). Trouble is, all the regexps I'm using to substitute variables, handle conditionals, etc, are extremely slow. (In fact, they are the bottleneck in several applications that do other expensive things like SQL queries on large tables). I have done some work to optimize the regexps, but my stuff is still only able to handle about 50-60 requests per second. (Without my template module, the same scripts can achieve 120-130 r/s on the same machine, making the same SQL queries). There must be a faster way. I have thought about pre-compiling each HTML file into a Perl module, but there would have to be an automated (and secure) way to suck these in if the original file changes. Either that, or maybe someone has written a better parser. My code looks something like this, to give you an idea of what I need: <p>My name is: <!-- name --></p> <!--#ifdef age --> <p>My age is: <!-- age --></p> <!--#endif --> To keep things simple and relatively efficient, I don't allow nested IFs. I've used HTML comments so that WYSIWYG editors or HTML validators don't complain. I've looked at some other template systems, and haven't really found much that interests me. Maybe someone can spark my interest again. Any thoughts? - Ryan -- Ryan Thompson <[EMAIL PROTECTED]> Network Administrator, Accounts SaskNow Technologies - http://www.sasknow.com #106-380 3120 8th St E - Saskatoon, SK - S7H 0W2 Tel: 306-664-3600 Fax: 306-664-1161 Saskatoon Toll-Free: 877-727-5669 (877-SASKNOW) North America