# Loading Performance Problems with Perspective bindings

**URL:** <https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [December 2, 2025, 2:18pm UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567 "2025-12-02T14:18:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [December 2, 2025, 2:18pm UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567/1 "2025-12-02T14:18:32Z")

</div>

Hi!  
I'm having performance problems with some binding on some gauges.

I belive that the code that is causing my problems is this one:

```python
	color = system.util.jsonDecode(value.get("color"))
	low = color[0]
	med = color[1]
	good = color[2]

	current = value.get("value")

	if current < int(med.keys()[0]):
		return low.values()[0]
	elif current < int(good.keys()[0]):
		return med.values()[0]
	else:
		return good.values()[0]

```

The value is a expression structure that comes from 2 custom properties that both are indirect tag paths.  
The color tag is an array like this: `[{"0":"#cf7911"},{"75":"#ffff00"},{"90":"#58d68d"}]`.  
The value tag is simply a integer value (0-100).

When removing this 4 gauges the page loads in 1-2 seconds, if not removed, it takes about 4-5 seconds.

How could I improve this?  
Any help is appreciatted.

If you wanna know about the objective of the code [here](https://forum.inductiveautomation.com/t/self-props-params-value-does-not-exists-but-it-does-exists/112447/9).

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 2, 2025, 2:36pm UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567/2 "2025-12-02T14:36:09Z")

</div>

> [@danielps1818](#):
>
> [{"0":"#cf7911"},{"75":"#ffff00"},{"90":"#58d68d"}]

Numbers are not valid keys for JSON/JS, I would restructure the object like this

```python
[
  {
    "value": 0,
    "color": "#cf7911"
  },
  {
    "value": 75,
    "color": "#ffff00"
  },
  {
    "value": 90,
    "color": "#58d68d"
  }
]

```

You can use an expression instead of firing up a script

```python
case(True,
	{this.props.value} >= {this.custom.colors[2].value}, {this.custom.colors[2].color},
	{this.props.value} >= {this.custom.colors[1].value}, {this.custom.colors[1].color},
	{this.custom.colors[0].color}
)
```

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [December 2, 2025, 2:40pm UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567/3 "2025-12-02T14:40:18Z")

</div>

Clever case statement. Good general rule of thumb as @dkhayes117 is hinting at here -expressions are always preferably for speed/effeciency over scripting whenever feasible.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 2, 2025, 2:46pm UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567/4 "2025-12-02T14:46:27Z")

</div>

Do not use `system.util.jsonDecode()` in performance critical scripts. You should use a Document tag, not a string. Then the actual binding can be an expression instead of a script.

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [December 2, 2025, 4:30pm UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567/5 "2025-12-02T16:30:52Z")

</div>

Seems to be that the problem was "bigger" than we thought... Is not the script, static simple gauges take about 5 seconds to load.

Help for the feedback guys!  
But I had to open a ticket to get it resolved.

---

<div class="post-metadata">

**Author:** ![ryan.white](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan.white/32/73193_2.png) [@ryan.white](https://forum.inductiveautomation.com/u/ryan.white)\
**Post date:** [December 2, 2025, 4:50pm UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567/6 "2025-12-02T16:50:48Z")

</div>

> [@danielps1818](#):
>
> static simple gauges take about 5 seconds to load.

The static gauges are a bit notorious for being slow, to the point that many use a script transform on an embedded svg instead.

> [@Perspective, faster page](https://forum.inductiveautomation.com/t/perspective-faster-page/69885/35):
>
> Okay, I had a bit of free time today, so here is a complete SVG solution. You could do the Label as SVG text as well, or a gauge needle if you wanted, I haven't gone that far. Just a little example of the power of using the Ignition Designer to add SVG elements. I didn't include the label for the example. Note: All of this (outside of the calculations needed to find the points for the shape) was done inside of the designer (yes I can be somewhat of a masochist at times. rofl). First a s…

I would recommend making the script part of the transform a function in the project library for easy re-use(and to avoid having to `import` inside of a function).

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [December 2, 2025, 4:56pm UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567/7 "2025-12-02T16:56:57Z")

</div>

For what it's worth, I would probably do this differently these days. Utilizing more CSS. Probably wouldn't even need a script transform. I can look into that if needed/wanted.

Something more along the lines of what I did in this thread.

> [@How to add animation by HTML/CSS scripts in Perspective?](https://forum.inductiveautomation.com/t/how-to-add-animation-by-html-css-scripts-in-perspective/75523/14):
>
> Okay, so it took me longer than I wanted (my laptop died), but I finally did get around to completing this, and I have to say I'm pretty pleased with the result. This was a fun exercise and I learned something good along the way. I will give you a disclaimer though, other than a rough idea of what an Azimuth Propeller is, I don't know much else. So for instance, I have no idea what the yellow triangle is supposed to indicate and so I didn't add it. I made some assumptions on how I think the re…

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [December 3, 2025, 11:09am UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567/8 "2025-12-03T11:09:33Z")

</div>

Hi guys!

I had a not so great morning. It looked like we have a big problem, and doing tests the only thing that doesn't work are the simple gauges. 🥲

I had done test with a lot of different components and configurations, and the only thing that takes the longest to load are the gauges. Those not only take about 4-5 seconds to load, but also delay the other components in the view.

I replace those with other components and the view load in less than a second. Makes no sense to me.

@lrose I'm gonna try to get a simple gauge using css and with the help of your post. I'll tell you how that goes...

Thanks to everyone that helped me!

---

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [December 3, 2025, 11:28am UTC](https://forum.inductiveautomation.com/t/loading-performance-problems-with-perspective-bindings/112567/9 "2025-12-03T11:28:16Z")

</div>

I ended up using this:

> **[Ignition Exchange](https://inductiveautomation.com/exchange/2461)**
>
> Discover, share, and download community made Ignition resources in collaboration with your organization or the Ignition community.
