Closed (fixed)
Project:
ImageCache
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
17 Apr 2009 at 20:47 UTC
Updated:
17 May 2009 at 12:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
zroger commented+1. This node_load causes some really hard to track performance issues.
Consider the case where you have a view that outputs a list of imagecache formatted images. If you selected 'Fields' for the views row-style, you would expect the view to be output without any additional database overhead. But instead theme_imagecache_formatter does a full node_load on every row, wreaking havoc on what should have been an optimized view.
Comment #2
drewish commentedthe first part of that patch looks good but the second seems kind of odd. i went ahead and grabbed the current code from imagefield's formatters since i know a lot of code is now handled by the cck sanitize op now so we should be able to do less in our formatters. make sure you're running the latest imagefield.
Comment #3
drewish commentedactually that needs a little work.
Comment #4
drewish commentedOkay this does a pretty big overhaul on the formatters to split them up into their own theme functions so they can specialize in just what they do and give someone an easy way to override the just nodelink formatter.
Comment #5
drewish commentedmarking #283922: Imagecache field formatter imagelink theme function as a duplicate since my last patch gives themers equivalent control.
Comment #6
drewish commentedcommitted to HEAD.
Comment #7
jcmarco commentedThis patch breaks existing imagecache configurations!
If you have an configuration with an _ in the presetname by example photo_node when the theme function explode the name into $presetname and $style then it takes presetname=photo and style=node_linked, in the case of a linked style.
In this case the directory and the presetname are wrong and no image is shown.
It should break the string giving the presetname all the first part of the $element['#formatter'] and the last string after last _ to the style string.
I attach a patch, probably there should be some cleanest way to do it.
Comment #8
drewish commentedWhoops, totally hadn't considered that case. Thanks for testing out the -dev release. If we can avoid a preg_match() I'd prefer that for performance reasons. The attached uses some more verbose string functions and just hard codes the strings where it makes sense.
Please test it out and let me know how it works for you.
Comment #9
neclimdulI'm not sure we actually should avoid using preg in this case. I made quick test script and it was actually faster to use preg_match than these combined string functions I'm pretty sure strrpos is a pretty slow function.
I've attached the script I ran but here's the results of 100k iterations over the two options splitting "100_box_default."
Comment #10
neclimdulI should also note that this was the /best/ result for the string functions. In the 10 tests I did it was generally around 8E-5.
Comment #11
drewish commentedneclimdul, wow, i ran your script and get basically the opposite results:
edit: I should note that I'm on OSX. I'd guess this is pretty platform dependant.
Comment #12
drewish commentedI went ahead and committed the preg free version just to get this working. i'd be open to further benchmarking though.
Comment #13
drewish commentedactually lets do any further benchmarking in a better named task ;)