Best practice for updating 1000 markup color in perspective map

Hi everyone,
I have a question on best practices for updating the map markup in perspective.
I have a map with about 1000 markup (that represents pump station) on it and I need to change each markup color base on related pressure tag value.
I can think of two method for that:
Method 1: when I have change in related pressure tag for each station, in tag change script, I send a message to gateway and then gateway send a message to perspective sessions code and in map massage handler I loop through markup list and find and update related markup color for that specific station.

Method 2: every 10 s in gateway I recreate markup list base on the related tag value and put this list on memory tag with type of document that use map markup JSON format, and finally simply bind it to map markup.
Which one is faster for user experience?
Is there any other way to do this?

I presume that you’ve tried using tag bindings and it’s unperformant? I’d expect it to be slow to load, but fast after it has, but that could be after 10’s of seconds…
My first thought was the tag change script method, or maybe bindings to all tags in a hidden component so you don’t see it loading. You might have to also read the value of al tags at startup to initialise the colours

1 Like

I would mix them as Method 3: Use a tag change script to monitor all of the pressures, and update a single timestamp memory tag when a pressure change yields a color change. Use a timer script (not a tag change) to check the timestamp tag every few seconds (or 10, perhaps) and regenerate the markup when changed.


The map itself is an unperformant component. But I’d like to hear new tricks. Phil mentions a very clever trick here.
Also, I find myself very good trick to help increase performance in the perspective script.
Never loop through a list that references an array property in perspcrtive. Instead, copy that property first then loop through it. For example list1 = map.markup[ : ]
As perspective runs on the server-side, a loop through the array property causes a WebSocket data transmission for each iteration which is slow.