Quote:
Originally Posted by ownedbycats
Mainly out of curiosity: Suppose you have a column with a single unmodified function, e.g. virtual_libraries(). Would there be any performance impacts involved in calling the #virtual_library column rather than the function directly?
(I'm also thinking -- if for some reason I were to change the column in the future, calling #virtual_libraries would avoid needing to change the function on all the templates calling it.)
|
This is hard to answer because it depends on context. If the column has been evaluated (displayed, sorted, something) then using the column will be faster because the result is cached. If the column has not been evaluated then calling the function will be faster because it avoids the overhead of handing the column. If you are using the template for search or sort then calling the function should be faster. Personally I would use the function because it is clearer what the template is doing, (as you say) it avoids unintended effects of changes, and the performance difference is zero to small.
Quote:
Also, I can't quite remember: In search, it's possible to do inclusive ands/ors with parentheses, e.g.:
#columnA:foobar AND (#columnB:foo OR #columnC:bar)
Would the best way to do this would to with a "IF foobar THEN foo||bar" type thing, or can the checks be done in the first IF?
|
Yes, you can do it in the first if in almost the same way as the search. For example, assuming your search is intended to be 'contains' (as written) you would write the if like this:
Code:
if 'foobar' in $#columnA && ('foo' in $#columnB || 'bar' in $#columnC) then
Quote:
Thanks and merry Christmas (or whatever holiday you celebrate).
|
Thanks. Same wishes to you.