While I was doing some performance work on the Glossary and Taxonomy List modules, I discovered that the Taxonomy Image calls were contributing a fair amount of time-to-render. The module does use static caching already and that wasn't helping nearly as much as I had hoped back when that was added.
As a test, I added Drupal caching (cache_xxx) and that made a noticeable improvement in the speed of things like Glossary and Taxonomy List. I haven't tested, but I would assume it would make a difference in any page that has several taxonomy images on it (regardless of how they are placed there). However, this improvement was only noticed when I created my own "cache_tax_image" table -- using one of the existing tables actually slowed it down.
Is anyone interested in having this added to the module as standard?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | taxonomy_image_cache5.patch | 5.67 KB | nancydru |
| #4 | taxonomy_image_cache6.patch | 3.96 KB | nancydru |
Comments
Comment #1
matslats commentedGot a new addon for you. This makes faceted_search work with taxonomy_image
Simply put the following function in template.php
function YOURTHEME_faceted_search_ui_category($category, $path) {
// Note: get_label() is responsible for filtering its returned string.
if ($path) {
$label = l($category->get_label(TRUE), $path, array(), NULL, NULL, NULL, TRUE);
}
else {
$label = $category->get_label(TRUE);
}
if (function_exists (taxonomy_image_display)){
$label = taxonomy_image_display($category -> _tid) . $label;
}
return ''. $label .' ('. $category->get_count() .')';
}
The clever bit is the second to last line.
Comment #2
nancydruVery interesting stuff. I would think this would be better placed in the Faceted Search module.
This thread was created to get some discussion on my possible addition of caching to the TI module.
Comment #3
Fayna commentedI would be interested! I think this would be a great addition to Taxonomy Image
Comment #4
nancydruHere are patches for 5.x-1.2 and 6.x-1.2. Testing is strongly encouraged. Please provide feedback here.
Comment #5
nancydruCommitted to 5.x-1.x-dev release.
Comment #6
nancydruCommitted to 6.x-1.x-dev release.
Both versions need testing and comment.
Comment #7
mariagwyn commentedNancy,
I am happy to help test it but I need to know what you are looking for. I have NOT used taxonomy image before, so I can't compare to previous versions. What sort of data do you need (other than, works-great or broke-my-whole-site!!!)?
Maria
Comment #8
nancydruThanks, Maria. Well, "works-great" or "broke-my-whole-site" is a good start. If you have Devel, you could also post some query times for the cache. I would be worried if you're seeing queries taking more than 0.5 milliseconds; I'd be thrilled if they are less that 0.25 ms.
Comment #9
mariagwyn commentedI do have devel, though I haven't gotten to the stage of actually noticing load times. It may take me a bit to get to this part of my site as I am still working through some upgrade issues, but I will let you know what I find when I get there.
Comment #10
nancydruThere will be no further official releases until there is adequate user testing and comment on this change.
Comment #11
zilla commentednancy, it's bugging out for me: first i got a blank white screen with this:
...taxonomy_image/contributed/taxonomy_image_node_display/taxonomy_image_node_display.module on line 17
then i reloaded afew times and got an error for each called image, like:
user warning: Table '{mydatabase}.cache_tax_image' doesn't exist query: SELECT data, created, headers, expire, serialized FROM cache_tax_image WHERE cid = 'taxonomy_image:52' in /.../html/includes/cache.inc on line 26. (but all different lines!)
Comment #12
zilla commentedhmm, that's interesting - apparently i'm an idiot...forgot to run update.php - did so and saw confirmation of this:
taxonomy_image module
Update #6100
CREATE TABLE {cache_tax_image} ( `cid` VARCHAR(255) NOT NULL DEFAULT '', `data` LONGBLOB DEFAULT NULL, `expire` INT NOT NULL DEFAULT 0, `created` INT NOT NULL DEFAULT 0, `headers` TEXT DEFAULT NULL, `serialized` SMALLINT NOT NULL DEFAULT 0, PRIMARY KEY (cid), INDEX expire (expire) ) /*!40100 DEFAULT CHARACTER SET UTF8 */
...but i'm not seeing the images now! not sure what i did earlier, but perhaps that "files/" directory vanished in upgrade? or maybe i accidentally blasted it? where should files/ be located (i'm going to create a new directory for files/taximages to hold them but not sure if files should be autogenerated in a new location...
Comment #13
zilla commentedat any rate, i went back in to teh site, uploaded a couple of taxonomy images and then checked via ftp to make sure they appeared in the right sites/default/files area (they were in there, saw them both) BUT they are not appearing on the site - i also flushed the cache via the admin page (performance) and checked again, and checked with a couple of themes...they just appear to be not displaying! no errors, nothing like that, just no visible taxonomy images in nodes or teasers (my settings allow for both)
Comment #14
nancydruBased on your update number, I'm assuming you're on Drupal 6.x. Let's start with going to the administer >> settings >> performance and clearing all the caches (button near the bottom). Then, using PHPMyAdmin, or something like it clear (truncate) cache_tax_image as well.
Comment #15
zilla commentedah, didn't do the phpmyadmin - i'm not that savvy so try to stay away but can get to it via my control panel...and yes, i'm on d6.2 right now.
Comment #16
nancydruWell, actually I found a way to make the Performance page do it, and it is now in the -dev version.
Comment #17
zilla commentedcool - i'll pull that down tonight and try it out...
Comment #18
nancydruReleased some time ago.