• Previous message: [greg-dev] Newbie q: single click to mark read?
  • Next message: [greg-dev] Re: [Gregarius-docs] Busy!
  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    [greg-dev] Re: [Gregarius-docs] Busy!

    (CC-ing this to the dev-list)
    
    Oh wow! I thought php would cache this kind of stuff. One thing we
    could do is to implement a template cache:
    
    - renderWithTemplate('templateName') tries the cache:
    - if cache-miss: load the content of the template
      (file_get_contents()) file into a variable and store
      it in $GLOBALS['rss']->cache['templateName']
    - else: load from the cache.
    - Render with eval() or something similar
    
    How does that sound?
    
    Or we could move to smarty or a similar "real" templating engine.
    
    
    >
    > The thing that has been bothering me is the theme engine. This is the
    > biggest bottle neck in the code for me. I used the profiler class to
    > check. The problem occurs because of the require('...item.php') every
    > time an item is rendered. These are expensive because php has to read the
    > file from the disk and compile it *every* time it encounters that. So on
    > the front page (index.php) it is doing that 100 times. I moved the
    > contents of item.php file in the default theme into a function and it
    > reduced the execution time of the front page from 2 seconds to 1 second.
    > (I have a slow server :) ) Do you have any thoughts about how we could
    > reduce the number of require statements?
    >
    > Sameer
    >
    
    
    Posted by Marco Bonetti [reply] at Thu Sep 22 19:09:41 CEST 2005