more abstraction committed
| From: | Monte Ohrt | Date: | Thu, 08 May 2003 20:34:52 +0000 |
| Subject: | more abstraction committed | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-1425@lists.php.net to get a copy of this message | ||
I committed some more (fairly major) changes.
So far, the following private functions have been removed from
Smarty.class.php and into their own plugin core files:
core.assign_smarty_interface.php
core.compile_template.php
core.create_dir_structure.php
core.display_debug_console.php
core.fetch_template_info.php
core.get_include_path.php
core.get_microtime.php
core.get_php_resource.php
core.is_secure.php
core.is_trusted.php
core.load_plugins.php
core.load_resource_plugin.php
core.parse_file_path.php
core.process_cached_inserts.php
core.read_cache_file.php
core.rm_auto.php
core.rmdir.php
core.run_insert_handler.php
core.smarty_include.php
core.smarty_include_php.php
core.write_cache_file.php
core.write_compiled_template.php
This has reduced the size of Smarty.class.php from 88K down to 52K.
There is still quite a bit more that can be abstracted, but this is a
good start.
I tried a simple benchmark to see how it responds. This is a simple
"hello world" template with one config_load call:
commmand_line:
2.5.0: 1.08s
cvs: 0.73s
apache with PHPA:
2.5.0: 0.122s
cvs: 0.120s
apache-gzip with PHPA:
2.5.0: 0.036s
cvs: 0.035s
As you can see, the gains from command line execution are quite nice,
but with PHPA the gains are almost negligible, but at least they are not
any slower so this abstration is not causing any performance drop!
I mostly abstracted things used during the compile phase. The other
things (like filepath rendering) I left to keep optimum speed. (I think
the filepath rendering should be cached instead of computed on each page
call. That's another project :-)
My goal is to abstract everything that can be done so without a
performance penalty. I think all of the compiler functions could be
broke down to this too, maybe getting rid of Smarty_Compiler.class.php
altogether.
Anyways, a LOT has changed here so bugs may be present. I tried to test
as good as I could, but please help!
FYI, I'm off to Las Vegas for one week starting tomorrow, so I won't be
too responsive until the 19th.
Let me know what you all think of this direction for Smarty.
Monte