View Single Post
Old 10-22-2020, 03:07 PM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,529
Karma: 8075744
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by capink View Post
This does not use assignments and should have better performance. I wonder whether putting this in a custom column instead might be better performance wise?
No. Color and icon rules cache the compiled template, as does a composite column, so there is no difference in execution time. Calibre also caches the results of rule evaluation, so a rule is reevaluated only if calibre thinks the data might have changed. This is roughly the same as the process used to cache composite column evaluation results.

Of note:
  • calibre generates GPM templates for all color/icon rules. There is no additional overhead in using advanced rules.
  • If your rules use stored templates then the compiled stored template is also included in the cache.
  • The new GPM template parser 'compiles' the template into an interpretable tree. The old parser 'compiled' the template into a stream of lexical tokens. The new scheme will be faster than the old one, especially for complex templates.
  • The "test" function used to evaluate both the "true" and the "false" branches then pick the right one. The function is now inlined as "if-then-else" where the unused branch is not evaluated.
chaley is offline   Reply With Quote