Using Templating on Dashboard nearly brings HA to its knees

Hi all,

I’ve been using Jinja before on a Dashboard, but it was simply to load the value of an entity, that worked fine.
Yesterday I was installing card-mod and I wanted to set a specific colour to the button, depending on a certain value of a text helper.
The text helper contains nothing but the name of the scene and the template checks (within card_mod:), whether of not is_state matches a certain name. If so, it sets background colour to grey.

card_mod:
  style: |
    ha-card {
      if is_state('input_text.livingroomscene', 'dinner') %} background: gray; {% endif %}
    

What I observe, when I set this script to about 6 button, it brings HA nearly to its knees. Suddenly to simply load automations overview, or entities overview takes 10-20 seconds.

Am I overlooking something or is something completely wrong here?

Any help is appreciated, cheers