You know, I hadn't thought of that, but that should be the case.  It's
simply caching the value from Snippet.find_by_name in a Hash stored in
an instance variable for the page being processed (which is discarded
along with the page at the end of the request).

So yeah – it should help.  Check out the benchmark script to get an
idea for what your speed-up should be.

-Andrew

On Fri, Apr 4, 2008 at 2:06 AM, Peter Haza <[EMAIL PROTECTED]> wrote:
> I presume one can see big improvements on feeds as these are usually
> implemented as recursive snippets?
>
>  ph
>
>
>
>  On Apr 4, 2008, at 5:16 AM, Andrew O'Brien wrote:
>
>
> >
> >
> >
> > Quick little hack I whipped up tonight:
> >
> > Fast Snippet provides a replacement to <r:snippet/> that speeds up
> > multiple calls to the same snippet in a single page
> > by caching the results of Snippet.find_by_name in an instance variable
> > of the rendering page.
> >
> > There's really only one situation where this helps: when a page calls
> > the same snippet multiple times using the
> > <r:snippet/> tag.  According to my benchmarks, substantial gains are
> > apparent after 15 - 20 calls.  However by
> > about 50, we start seeing orders of magnitude difference in speed.
> >
> > For more information:
> >
> > http://github.com/AndrewO/fast_snippet/tree/master
> >
> > I definitely want to stress that this only really helps if you're
> > calling the same snippet over and over again in the same page, just so
> > no one thinks I'm offering something totally awesome that will fix any
> > other performance problems you might be having. ;)
> >
> > -Andrew
> > _______________________________________________
> > Radiant mailing list
> > Post:   [email protected]
> > Search: http://radiantcms.org/mailing-list/search/
> > Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
> >
>
>  _______________________________________________
>  Radiant mailing list
>  Post:   [email protected]
>  Search: http://radiantcms.org/mailing-list/search/
>  Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to