photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: ben on September 22, 2023, 09:18:23 PM

Title: FileWindow Layout to check for certain category
Post by: ben on September 22, 2023, 09:18:23 PM
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
Title: Re: FileWindow Layout to check for certain category
Post by: Mario on September 23, 2023, 10:06:35 AM
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?
Title: Re: FileWindow Layout to check for certain category
Post by: ben on September 23, 2023, 10:54:06 AM
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>





Title: Re: FileWindow Layout to check for certain category
Post by: Mario on September 23, 2023, 02:27:42 PM
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.

Title: Re: FileWindow Layout to check for certain category
Post by: Darius1968 on September 23, 2023, 03:07:57 PM
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. 
Title: Re: FileWindow Layout to check for certain category
Post by: ben on September 23, 2023, 04:51:20 PM
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!
Title: Re: FileWindow Layout to check for certain category
Post by: Darius1968 on September 23, 2023, 07:22:28 PM
You're most welcome... Glad I was able to help!  ;D