wouldnāt you think that since in both cases the āifā needs to be evaluated, a difference in computing time is negligible?
Must confess that since these are all jinja templates, and require constant backend logic, and hence traffic to and from the frontend to the backend and back again, I try to minimize these templates in card_mod as much as possible. Itās very heavy on the system indeed.
itās quite remarkable (Iād even go as far as to say itās shocking) to see how many evaluations take place when running the profiler template option.
Iāve tried minimizing after seeing that hard proofā¦
Another aspect, and that is untouched in this discussion, is the lack of an āelseā clause in those templates. I am aware we all believe (or maybe even are told) card_mod takes care of that, but talking about āemptyā properties, Iād always prefer to have an āelseā resolution there. Canāt proof it, but it does make me feel safer.
My summary would be:
if you truly ārequireā templates in the card_mod mods, do it either way, and always use an else
.
try to minimize templates as much as possible, itās heavy on the system.
preloading them might even be heavierā¦
just see this (untemplated) card_mod in action and watch the frontend struggle:
which is a basic card config mod like:
entities:
- type: custom:fold-entity-row
card_mod: &scroll
style: |
#measure {
max-height: 300px;
overflow-x: hidden;
overflow-y: scroll;
}
head:
type: section
label: Binnen
card_mod: &label
style: |
.label {
margin-left: 0px;
}
padding: 0
entities:
- type: custom:auto-entities
card: &type_mod
type: entities
card_mod:
style: |
ha-card {
box-shadow: none;
margin: 0px -16px;
}
now consider adding templates to thoseā¦
card_modās impact is not to be neglected.