Compressessed Smarty class
[email protected] (Markku Niskanen)
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <[email protected]> |
>Please share if you compressed it at RUN time, EACH time,
>or compressed it and saved it back to the file system.
Well "compressed" sort of... this is the code in all its
complexity:
<?php
// stripsmarty.php
$result = php_strip_whitespace('Smarty.class.php');
echo $result;
?>
then I simply ran PHP5:
php stripsmarty.php >Smarty.stripped.php
and ran the tests using the two files. I did not test
Smarty.compiler.class as it is mainly necessary in
the development phases. To answer your question:
(c) compressed the file and saved to the system.
I do not believe that anybody running an opcode cache
will get any benefit from the 'compression' but those without
one just might... one has to remember, though, that this is a
minor improvement and only speeds up the parsing/compilation
phase.
Hmm... some time ago I wrote a small obfuscator that did a
decent job making the class/function variables a lot shorter and it
is a known fact that this will speed the parsing phase as
well. If I can find the obfuscator (hope I have not obfuscated
the class itself during the testing phase) I will re-run the tests.
I came across this method when phpdoc-commenting
a class and seeing the file grow horribly.
Markku
--
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php