FileWindow Layout to check for certain category

Started by ben, September 22, 2023, 09:18:23 PM

Previous topic - Next topic

ben

I am using the following custom template in a filewindow layout to display if the file is assigned to a certain category.

<Run>{File.Categories|contains:myCategoryName,yes,no}</Run>

This seems to be quite computing intensive, since scrolling is much slower compared to other layouts (~100 files in the filewindow scope).

Is there a better way to do this?

Thanks for any hints.
Ben

Mario

IMatch must parse and evaluate the custom templates every time the File Window redraws. For example, while you scroll.

When there are 100 thumbnail panels visible or in the prefetch areas above/below the visible items (x), it needs to

a) figure out all categories containing a file
b) comparing the resulting list of category paths figure out if MyCategoryName appears in the list of categories for the file

This might also require to re-evaluate formula-based categories and data-driven categories, if they are invalid or not cached.
And that 100 + x times. Every time the File Window needs to repaint, which is often.
This will slow down scrolling considerably.


Maybe you can limit where the variable has to search to a certain sub-section of categories?
Or use Categories.Direct if you know that MyCategoryName is not a data-driven or formula-based category?
Or, it might be in a formula or data-driven category, restrict the search to a certain level using the .Level variant?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ben

Thanks for your replies, i understand why it is so compute intensive.
I also understand from your answer, that there is no other way to do it, right?




QuoteMaybe you can limit where the variable has to search to a certain sub-section of categories?
I tried combining it with a filter, but that doesn't improve it. I assume it's because my files have just a few categories assigned anyways.
<Run>{File.Categories|filter:^myRootCategory;contains:myCategoryName,yes,no}</Run>






Mario

The .Direct variant should be the fastest since it excludes data-driven and formula-based categories.
And that's as fast as it gets.

Or, maybe you can create a data-driven category to group files based on the category name you are interested it, and then use that in the variable? The variable then would have to search (recursively) only one category. Not sure if this is possible, it depends.

The problem is that the File Window repaints often, especially when you scroll.
Normally not a problem, since the File Window and the way it accesses data has been tuned to the hilt to be fast.
But adding a very slow to calculate variable like this will slow down things considerably. No free lunch and all that.
Might need some experiments.

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Darius1968

Maybe, as a workaround, set that data driven category not to auto-update and to a certain designated color for color-coding purposes that will let you know right-off-the-bat what category it is.  Then, when you know you need that info, you could just update that one category on the fly. 

ben

QuoteMaybe, as a workaround, set that data driven category not to auto-update and to a certain designated color for color-coding purposes that will let you know right-off-the-bat what category it is. 
That's great :-)
I've never used color coding for categories, only for the files&folder-view.
Now, I enabled the category bar in my specific view and now i can see all files of a specific category with a red bar. 
Thanks a lot!

Darius1968

You're most welcome... Glad I was able to help!  ;D