Re: [SMARTY-DEV] more abstraction committed

From: Date: Tue, 20 May 2003 10:01:59 +0000
Subject: Re: [SMARTY-DEV] more abstraction committed
References: 1  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1465@lists.php.net to get a copy of this message
Hello all, I been thinking of this abstraction effort for some time and I'm not sure this is the way to go. I like the reduced size of the Smarty class file and of course the performance gain :) for displaying the templates, but I don't like the core.(.*).php files. I thinking you lose grip of the functions. I rather see them grouped together. You also lose the ablity to overwrite the functions with your own by extending the Smarty class. Instead of extending and overwrite functions you could of course replace the core.(.*).php files with your own, but that makes upgrading less seemingless Since the most of the moved functions apply to the compiling process of the templates. I'm thinking way not move the functions to the compiler class. Then you still recude the size of the Smarty class (the displaying process). You keep the functions grouped together. You can overwrite the functions by extended the compiler and the functions are included all at once when they are needed. An other idea might be breaking up Smarty into more generalized class files for the different layers. Something like common config compile storage cache. This would open the way for easier adding functionality to Smarty. One could for instance add an database storage container and share this with the rest of the Smarties ;-) Greetings, Jan Rosier * Announcer: Far out in the uncharted backwaters of the unfashionable end of the western spiral arm of the galaxy lies a small, unregarded yellow sun. Orbiting this at a distance of roughly 92 million miles is an utterly insignificant little blue-green planet whose ape-descended life forms are so amazingly primitive that they still think digital watches are a really neat idea. * ----- Original Message ----- From: "Monte Ohrt" <monte@ispi.net> To: "Smarty Dev" <smarty-dev@lists.php.net> Sent: Thursday, May 08, 2003 10:34 PM Subject: [SMARTY-DEV] more abstraction committed > 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 > > > > -- > Smarty Development Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

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