[development] Increase performance of caching
Larry Garfield
larry at garfieldtech.com
Mon Apr 30 18:28:23 UTC 2007
Drupal uses a lot of static caching, so in concept I don't see a problem with this. Benchmarks would be useful, though, both on speed and memory usage.
That said, this should be submitted as a feature request patch against Drupal 6 so that it can be reviewed in the issue queue rather than on the dev list. See:
http://drupal.org/node/320
http://drupal.org/patch/create
Thanks!
--Larry Garfield
On Mon, 30 Apr 2007 11:22:04 -0600, "Jeff Fillmore" <jfillmore at sublimenet.com> wrote:
> Dear Developers,
>
>
>
> I’ve been working with a few modifications to the caching
> system of Drupal, and have found a simple way to speed it up by about 5%
> across the board ( more with pages that use the cache system more) with
> only adding five lines of code.
>
>
>
> I found that Drupal was calling the cache table multiple times
> to get the same data so I put the data in a static array.
>
> At the top of cache_get function in includes/cache.inc I added these four
> lines on line 15:
>
>
>
> static $cache_array = array();
>
> if ($cache_array[$key] != null){
>
> return $cache_array[$key];
>
> }
>
>
>
> Right before $cache is returned I added this line on line 45:
>
>
>
> $cache_array[$key]=$cache;
>
>
>
> I am sure there are lots of other ways to do this, but the reason that I
> modified the core code directly is that I felt that this type of increase
> should not a matter of adding a new module, if it is even possible with
> another module. Although this will increase the overall size of the apache
> children during runtime I felt that it was a small price for the speed of
> the application and overall user throughput. Also are there any other
> places that we could do something similar. For instance cache the menus in
> memory for the ‘drupal_lookup_path’ for instance.
>
>
>
> Because this is in the caching for registered and anonymous users the
> benefit is across the board. Although the increase will diminish over the
> size of the site, it should be a rather substantial increase for about
> 70-80% of the drupal installs out there.
>
>
>
> I am curious to hear feedback as to what you guys think of this addition,
> and the overall speed increase and offsets. And potentially other
> increases that would be of similar avenues and if we should pursue them.
>
>
>
>
>
> Thanks
>
>
>
> Jeff Fillmore
>
> HYPERLINK "mailto:jfillmore at sublimenet.com"jfillmore at sublimenet.com
>
> Sublimenet INC
>
> 208-323-9451
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.467 / Virus Database: 269.6.2/781 - Release Date: 4/30/2007
> 9:14 AM
>
>
>
More information about the development
mailing list