Commit Graph

14 Commits

Author SHA1 Message Date
Andy Staudacher
fd94f4bec2 Fix Kohana's internal cache for Gallery's usage pattern. Instead of deleting the whole find_files cache when ever include_paths (=core.modules) change, keep a separate find_files cache for each set of include_paths.
Benefits for Gallery:
 - There are about 3000 is_file() invocations for a photo / album page in a vanilla Gallery installation. These are mostly triggered by Kohana::find_file().
 - Enabling internal_cache doesn't help at all (see explanation below). The number of is_file() invocations is about the same with or without this cache.
 - With this patch, more than 95% of these invocations are gone. The cache works as intended.

Kohana's internal_cache for find_file wasn't working in Gallery because
the cache would be emptied on each request after reading it from disk and
before most lookups would run.
 1. Bootstrap sets initial core.modules (= include path): forge, kohana23_compat, gallery.
 2. Kohana::setup() loads find_file cache from disk.
 3. Gallery loads list of active modules and themes, and updates the core.modules value (=include path), which forces the internal find_file cache to be empties (which makes sense).
 4. Request processing starts, and thus 80+% of all Kohana::find_file() triggered  is_file() invocations start off with an empty find_file cache.

The patch doesn't have a significant impact on performance for Kohana applications which don't change their include paths at runtime (after Kohana::setup). And the patch should benefit all Kohana applications which have modules / extensions, i.e. which first need to bootstrap Kohana before they can load a list of all active modules from the database.
2010-02-28 13:51:18 -08:00
Andy Staudacher
ff9129c598 Revert "Fix Kohana's internal cache for Gallery's usage pattern."
Waiting for feedback from Kohana devevelopers before applying the patch to Gallery 3.

This reverts commit 336c3bd264.
2010-02-21 23:57:29 -08:00
Andy Staudacher
336c3bd264 Fix Kohana's internal cache for Gallery's usage pattern. Instead of deleting the whole find_files cache when ever include_paths (=core.modules) change, keep a separate find_files cache for each set of include_paths.
Benefits for Gallery:
 - There are about 3000 is_file() invocations for a photo / album page in a vanilla Gallery installation. These are mostly triggered by Kohana::find_file().
 - Enabling internal_cache doesn't help at all (see explanation below). The number of is_file() invocations is about the same with or without this cache.
 - With this patch, more than 95% of these invocations are gone. The cache works as intended.

Kohana's internal_cache for find_file wasn't working in Gallery because
the cache would be emptied on each request after reading it from disk and
before most lookups would run.
 1. Bootstrap sets initial core.modules (= include path): forge, kohana23_compat, gallery.
 2. Kohana::setup() loads find_file cache from disk.
 3. Gallery loads list of active modules and themes, and updates the core.modules value (=include path), which forces the internal find_file cache to be empties (which makes sense).
 4. Request processing starts, and thus 80+% of all Kohana::find_file() triggered  is_file() invocations start off with an empty find_file cache.

The patch doesn't have a significant impact on performance for Kohana applications which don't change their include paths at runtime (after Kohana::setup). And the patch should benefit all Kohana applications which have modules / extensions, i.e. which first need to bootstrap Kohana before they can load a list of all active modules from the database.
2010-02-21 21:29:24 -08:00
Andy Staudacher
6cbe0f78aa Revert "Fix Kohana's internal cache for Gallery's usage pattern."
This reverts commit 5ddd7c9677.
2010-02-21 21:07:55 -08:00
Andy Staudacher
5ddd7c9677 Fix Kohana's internal cache for Gallery's usage pattern.
Adds a core.internal_cache_read_only config variable to Kohana's internals.

Kohana's internal_cache for find_file wasn't working in Gallery because the cache would be emptied on each request after reading it from disk and before most lookups would run.
 1. Bootstrap sets initial core.modules (= include path): forge, kohana23_compat, gallery.
 2. Kohana::setup() loads find_file cache from disk.
 3. Gallery loads list of active modules and themes, and updates the core.modules value (=include path), which forces the internal find_file cache to be empties (which makes sense).
 4. Request processing starts, and thus 80% of all Kohana::find_file() triggered  is_file() invocations start off with an empty find_file cache.

In the case of my small Gallery installation, we're talking about 3100 is_file() invocations per request with or without internal_cache enabled. With this fix, this number is down to 800 invocations.

The basic idea is that we treat the cache as read only and don't write any (possibly dirty) values to it in memory until we're sure that the include path won't change later on in the request processing. Once we know the list of active modules and themes, we can update core.modules and finally flip the read-only state of the cache and start writing to it.
2010-02-21 20:04:06 -08:00
Tim Almdal
a74fd27e5f Updated Kohana to r4737 2010-01-06 11:35:01 -08:00
Bharat Mediratta
3e8e13bd25 Updated Kohana to r4728 2009-12-23 12:42:57 -08:00
Bharat Mediratta
9285c8c66c Updated Kohana to r4724 2009-12-21 20:05:27 -08:00
Bharat Mediratta
9b6663f87a Update to Kohana r4684 which is now Kohana 2.4 and has substantial
changes.
2009-11-24 19:20:36 -08:00
Tim Almdal
3643706a2e Apply local fix for Kohana ticket 2276. 2009-10-23 08:25:58 -07:00
Bharat Mediratta
b179b106c2 Update Kohana to r4409 2009-06-06 14:51:04 -07:00
Bharat Mediratta
b0cb3c7402 Update Kohana to r4374 2009-05-29 12:00:49 -07:00
Bharat Mediratta
d8f2c9f9f7 Revert "Change Kohana::include_path() to put APPPATH (core) at the end of the"
This reverts commit 7e37055408.

No longer necessary now that we're putting all the code into
modules/gallery, which we can force to be at the end of the module
path.
2009-05-28 17:42:06 -07:00
Bharat Mediratta
12fe58d997 Rename 'kohana' to 'system' to conform to the Kohana filesystem layout. I'm comfortable with us not clearly drawing the distinction about the fact that it's Kohana. 2009-05-27 15:11:53 -07:00