Filebrowser: Display Image Usage

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Filebrowser: Display Image Usage

Post by cmb » Sat Sep 01, 2012 8:55 pm

Hello Community,

Jerry reported performance problems related to determining the image usage in the filebrowser. I've made an improvement, which seems to be ok for a moderate content size and a moderate amount of images in a single folder (r278).

But then I've made same benchmark tests with a relatively large content (~500 KB; 155 pages with 5 images each). Calling the filebrowser on images/flags/ (19 files) is approximately 16 times slower than for the empty images/! 90% of the time is spent calling preg_match() in Filebrowser::fileIsLinked(), as this function is called number_of_files_in_folder * number_of_pages times (in this case 2945 times!).

As this content size and the number of images shouldn't be too unusual, I still consider the performance barely acceptable. So I have rewritten the usage detection. This slows down the filebrowser a bit (in the test case about 20%), even if there are no images in the folder, but doesn't take much more time, even if there are many images.

I would prefer the latter solution, but it is barely tested. So what should we do?

Christoph

PS: for reference: the issue about missing usage information was reported in a German thread.
Christoph M. Becker – Plugins for CMSimple_XH

simpleSolutions.dk
Posts: 155
Joined: Thu Oct 06, 2011 7:00 am

Re: Filebrowser: Display Image Usage

Post by simpleSolutions.dk » Sat Sep 01, 2012 10:36 pm

Hi Christopher
In this case I will prefer the later solution supplied with an option to disable image tracking.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Filebrowser: Display Image Usage

Post by cmb » Tue Sep 04, 2012 9:33 pm

Hi Jerry,

thanks for giving your opinion :) Indeed that seems to be reasonable, perhaps even defaulting not to track the image usage?

BTW: thanks for the wording "image tracking". I really like it. :)

Christoph
Christoph M. Becker – Plugins for CMSimple_XH

simpleSolutions.dk
Posts: 155
Joined: Thu Oct 06, 2011 7:00 am

Re: Filebrowser: Display Image Usage

Post by simpleSolutions.dk » Fri Sep 07, 2012 11:25 am

Hi Christoph

Why to hide a useful functionality (it was avialable for CMSimple since File Administration plugin). I would certainly prefer that the image tracking is on by default. Off setting makes only sense if you expect problems on websites with lots of content. Otherwise, drop an option to turn off the image tracking.

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Filebrowser: Display Image Usage

Post by cmb » Fri Sep 21, 2012 4:20 pm

I've made some tests with the new image tracking routine acting on a very large content file (4.5 MB). In this case calling the filebrowser takes about 50% more time than without image tracking, which seems acceptable regarding such large content. For typical content sizes the overhead is much lower (see above), and so I assume we can do without a config option to disable it.
Christoph M. Becker – Plugins for CMSimple_XH

simpleSolutions.dk
Posts: 155
Joined: Thu Oct 06, 2011 7:00 am

Re: Filebrowser: Display Image Usage

Post by simpleSolutions.dk » Sat Sep 22, 2012 5:55 am

;)

Post Reply