Re: [SMARTY-DEV] Re: speed improvement idea: path caching
| From: | boots | Date: | Mon, 23 Jun 2003 07:00:39 +0000 |
| Subject: | Re: [SMARTY-DEV] Re: speed improvement idea: path caching | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1673@lists.php.net to get a copy of this message | ||
Sorry if this is real obvious, but another cool thing about having a
path cache per called template is how it can be used to identify the
need to compile--especially if timestamps are included with the path
cache and if all path cache files are stored in a single directory.
1) path cache file does not exist?
- compile template
- write new path cache file
2) path cache file exists && no compile check?
- only load compiled template (don't load path cache file)
- (is that true? I don't see why it would be needed)
3) path cache file exists && (compile check || force compile)
- load the path cache file, iterate and match timestamps
compiling as required. write new path cache file(s) as required.
If it is assumed that a compiled file MUST exist in the case that its
corresponding path cache file exists then additional assumptions can be
made: eg. the compiled file is readable, the compiled file is writable,
etc. This means that the extra file system call overhead of using an
additional file per called template can potentially be offset by
reducing the number of filesystem calls currently made on compiled
templates. Of course, the first time you compile, you'd still have to
make appropriate checks, but after that, you can can relax a bit and
rely on the cache path files alone to determine compilation needs.
a crazy idea: write the cache path files to shared memory using
something like pear::Stream__SHM on compliant systems.
Again, sorry if that was obvious but I thought it was really neat. I'm
sure Monte has something far more clever in mind. :)
xo boots
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com