[SMARTY-DEV] Compressessed Smarty class
| From: | (Markku Niskanen) | Date: | Tue, 06 Jul 2004 07:35:37 +0000 |
| Subject: | [SMARTY-DEV] Compressessed Smarty class | ||
| References: | 1 2 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2439@lists.php.net to get a copy of this message | ||
>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