Skip to content
Version 2026.25

Choosing a binding ​

A component property shows a live value through a binding. Raylux has six kinds, and five transforms you can chain onto most of them. They differ in what they can do, but more importantly in where they run and what they cost. This page helps you pick the right one and shows the numbers behind the advice.

The short version:

  • Show a tag? Use a Tag binding. It is the fastest thing Raylux has.
  • Combine tags, or do arithmetic or if() logic? Use an Expression binding.
  • Turn a number into a word, a color or a style class? Add a Map transform to the binding you already have.
  • Need Python, a library function, or something no expression can do? Use a Script transform or a Script binding, but only where few values change. Each run costs milliseconds in Nexus, not microseconds.

Where each one runs ​

Spectrum, the operator runtime, runs in the browser. Nexus is the gateway. Some bindings are worked out in the browser, others in Nexus, and that decides how they scale:

Binding (Studio name)Where it runsWhat it can doDon't use it for
TagNexus sends the value. Its transforms run in Nexus before the value is sentOne tag, direct or indirect ({1} tokens), optionally read-writeCombining several tags (use Expression)
PropertyBrowser. Map, Format and Expression transforms run in the browser; Script and Node transforms go to NexusAnother component's property, or session.*, page.*, view.params.*A value a tag binding could show directly
ExpressionBrowser (the tags it reads are subscribed for it)Several tags and properties, arithmetic, if(), string and date functionsAnything that needs Python or the network
ScriptNexus, on the script poolAny Python, the raylux.* API, library functionsFast-changing values, or one copy per label on a big screen
QueryNexus runs the named query; transforms as for PropertyDatabase rows, polledLive values (poll it, don't bind it per tag)
HistoryNexus reduces the history; transforms as for PropertyRaw points or one aggregate (avg, integral for kWh…)Live values

The transforms:

TransformWhere it runsUse it for
MapWhere its binding runs (Nexus on a Tag binding, browser otherwise)Value → text, color or style class, by condition rows (value > 80)
FormatSameNumbers (#,##0.0) and dates (yyyy-MM-dd HH:mm)
ExpressionSameArithmetic on the value (value * 1.8 + 32)
ScriptAlways NexusPython on the value
NodeAlways Nexus (compiled to Python)The same as Script, drawn as a node graph

Event scripts (a button's On Click, a component's message handler) are not bindings: they run in Nexus when the operator does something, and they write tags or session properties rather than showing a value. Bind the property to the tag or session property the script writes.

How fast each one is ​

These are measured numbers, not estimates. The method is at the end of the page, along with how to re-run it. Treat them as relative costs: a slower machine scales them up, but the order does not change.

Inside the browser ​

One evaluation, on the Spectrum engine (V8, the engine in Chrome, Edge and Lens):

StepTime per evaluation
Expression transform value * 1.8 + 32~0.1–0.2 µs
Map transform, 3 rows~1–2 µs
Expression binding {tag} * 1.8 + 32~2–3 µs
Format transform #,##0.0~3–5 µs
Expression binding with if()~3–6 µs

Those are tiny, but Spectrum re-resolves every binding on the screen each time it renders a change, not only the one whose tag moved. What a whole screen costs per pass, by size:

ScreenTagExpressionProperty + MapProperty + Format
1 bound label1.4 µs6.5 µs4.5 µs6.2 µs
100 labels0.08 ms0.8 ms0.5 ms0.7 ms
1000 labels0.9 ms12 ms8 ms10 ms

A tag binding is cheapest because Nexus has already done its work; the browser only looks the value up. An expression is parsed afresh every pass, which is why 1000 of them cost ~13× as much.

Gateway side ​

The cost of each binding in Nexus, at 1 Hz. Latency is from the tag changing in Nexus to the value leaving Nexus (for a script binding or a Property-binding script transform, to the result coming back). CPU is Nexus process CPU, where 100% is one core; the test tags themselves cost 11% with nothing watching.

Bindings changing once a secondUpdates/sLatency p50 / p95Nexus CPU
Tag, 100010000 / 1 ms16%
Tag + Map, Format or Expression transform, 100010000 / 1 ms16–17%
Tag + Script transform, 1001002 / 5 ms30%
Tag + Script transform, 100099789 / 244 ms341%
Property + Script transform, 10010051 / 71 ms59%
Property + Script transform, 1000989326 / 561 ms637%
Script binding, 10010055 / 88 ms85%
Script binding, 1000758 (falls behind)766 / 2548 ms717%

The same at 10 Hz (tags written by a gateway timer script; 14% baseline):

Bindings changing ten times a secondUpdates/sLatency p50 / p95Nexus CPU
Tag, with or without Map, Format or Expression, 100010 0000 / 3–8 ms32–38%
Tag + Script transform, 10097419 / 99 ms346%
Tag + Script transform, 1000830 of 10 0005.6 s / 14 s556%
Property + Script transform, 10072578 / 307 ms237%
Property + Script transform, 10008471.1 s / 2.5 s485%
Script binding, 100652162 / 330 ms467%
Script binding, 10007281.1 s / 2.2 s674%

Property-binding script transforms and Script bindings top out at about 8 updates a second each, because Spectrum asks for a new result at most every 120 ms per binding. Tag-binding script transforms have no such limit: Nexus queues every change, and when it falls behind the queue only grows (see the pitfalls).

The step from Map/Format/Expression to Script is roughly a thousand times in CPU per value: about 3 ms (on a Tag binding) to 6 ms (on a Property binding) of Nexus CPU for each script-transform run, and about 9 ms for each script-binding run, against microseconds for the others. A script binding also makes two trips (Spectrum sees the tag change, then asks Nexus to run the script), so even an idle gateway adds ~5–10 ms.

Tag change to screen ​

End to end, in a real Spectrum page (Chrome, one operator), all labels changing once a second. Main thread is how busy the browser page is; above ~50% the screen starts to feel slow to clicks and scrolling.

Screen, 1 HzLatency p50 / p95Main thread
100 Tag-bound labels2 / 6 ms4%
100 Expression-bound labels6–7 / 10 ms6–7%
100 Property + Format labels8 / 12 ms7%
100 Script-bound labels75 / 104 ms8%
1000 Tag-bound labels167 / 238 ms40%
1000 Expression-bound labels258–306 / 357–414 ms51–53%
1000 Property + Format labels329 / 432 ms52%
1000 Script-bound labels789 / 1497 ms~100%

At 10 Hz (two runs; this busy machine spread them widely, so both ends are shown):

Screen, 10 HzLatency p50 / p95Main thread
100 Tag-bound labels5–12 / 12–21 ms9–19%
100 Expression-bound labels9–16 / 13–47 ms15–28%
100 Property + Format labels8–53 / 12–125 ms14–75%
100 Script-bound labels68–71 / 140–156 ms74–82%
1000 labels of any kind8–11 s / 13–18 s~100%

1000 labels changing ten times a second is more than one Spectrum page can draw, whatever the binding: 10 000 changes a second arrive as 10 000 separate messages. Show fast values on fewer labels, slow the tag group down, or use a chart (one component, many points).

Which one should I use ​

  1. Is it one tag, shown as it is or lightly changed? → Tag binding. Add Map, Format or Expression transforms freely: on a Tag binding they run in Nexus and cost nothing you can measure.
  2. Does it combine tags, or a tag with a property or parameter? → Expression binding. Keep each expression short; they run on every screen update.
  3. Is it a value another component already has? → Property binding. Don't re-bind the same tag twice.
  4. Does it need Python? Ask first whether an expression can do it: if(), coalesce(), concat(), dateFormat(), clampVal() and roundDec() cover most of what people reach for a script to do. If it really needs Python:
    • the value comes from a tag → a Script transform on the Tag binding;
    • the value comes from several places, a library function or a calculation → a Script binding, with a Poll rate only if it reads tags whose paths it builds at run time.
  5. Is it database rows or history? → Query or History binding, polled no faster than the data changes.
  6. Is the same calculation on many screens, or needed by alarms, history or other scripts? → put it in an expression tag (or a gateway script that writes a tag) and bind to that tag. Nexus computes it once for everyone, instead of once per open screen.

Worked examples ​

Pump status text and color ​

A pump's Running and Fault tags drive a label. One Expression binding on Text:

if({[DEFAULT]Pump1/Fault}, "FAULT", if({[DEFAULT]Pump1/Running}, "Running", "Stopped"))

…and a Tag binding on the label's Style class, bound to Pump1/Fault with a Map transform whose output type is Style class: value == true → alarm-text, fallback normal-text. No script anywhere, and the map runs in Nexus.

Temperature in °F ​

A Tag binding to [DEFAULT]Oven/TempC with an Expression transform value * 1.8 + 32, then a Format transform 0.0 °F. Both transforms run in Nexus before the value is sent.

A tank's fill percentage of its own setpoint ​

The tank's Value reads a level tag; a label next to it shows the level as a share of a setpoint the operator types into a numeric input. Expression binding on the label:

roundDec({[DEFAULT]Tank1/Level} / {SetpointInput.value} * 100, 1)

{SetpointInput.value} is a component property, which only the browser has, so this is an expression binding, not an expression tag.

A label that needs a library function ​

Tank1/Level is in raw counts and a project library function scaling.toPct already does the conversion. A Script binding on Text:

python
counts = raylux.read_tag("[DEFAULT]Tank1/Level")
return "%.1f %%" % raylux.custom.scaling.toPct(counts)

Nexus re-runs it whenever Tank1/Level changes, because the path is a literal string in read_tag. One of these is fine; a screen of 200 of them changing every second is not. Move the conversion into an expression tag instead.

Pitfalls ​

A Script binding that calls the network runs on every change

A Script binding re-runs every time a tag it reads changes, and on every Poll rate tick. Put raylux.net.get(...) in one and every operator's screen calls that server each time, waiting up to the 5-second script limit and holding a script worker while it does. Fetch from a gateway timer script that writes the result to a memory tag, and bind the label to that tag.

Script and Node transforms on a Tag binding run for everyone

Nexus runs the transforms saved with the project for every session: designers, operators and anonymous kiosks alike. Each script runs as the person looking at the screen (or as an anonymous user on a kiosk), the same rule as a Script transform on a Property binding. Save the project and open screens pick up an edited chain without reconnecting. Studio's Preview runs the transforms you have not saved yet; Nexus never runs a script a browser sends unless it comes from a signed-in designer.

  • Spectrum subscribes to every screen in the project, not only the open one. In the test, the same 100-label screen used 4% of the browser's main thread on its own, and 29–40% (latency p50 2 → 21–32 ms) once the project also held a 1000-label screen that was never opened. Keep test and scratch screens out of a production project, and split very large projects.
  • Script work queues. Scripts run on a pool of 2 × CPU cores threads (at least 4, at most 40). A burst of evaluations, such as 1000 labels whose tags all change at once, waits its turn: 100 script bindings ticking together already add ~50 ms.
  • A Script transform on a fast Tag binding can bury the gateway. Nexus queues one evaluation per tag change with no limit. 1000 of them at 10 Hz asked for 10 000 runs a second; Nexus managed 830, the delay grew past 14 seconds, and the queue went on running after the screen was closed. Keep Script transforms off tags that change quickly.
  • Spectrum asks Nexus for a script result at most every 120 ms per binding. A Script binding or Property-binding Script transform on a tag faster than ~8 Hz shows only some of the values.
  • Expressions are re-parsed every pass. 1000 expression-bound labels cost ~12 ms per screen update in the browser. Above a few hundred, move shared logic into expression tags.
  • Polling is not free. A Query, History or Script binding with a poll rate runs for every open screen that holds it, not once for the plant.
  • A Map's Fallback is what shows when no row matches. Left blank, the output is blank, as in Ignition. Type something like Unknown so an unexpected value is visible rather than an empty label. To show the input value itself instead, set When no row matches to Pass the input through.

Upgrading from 2026.24 or earlier

Maps saved before 2026.25 with a blank fallback now show blank when no row matches; they used to show the input value. To get the old behavior, open the binding and set When no row matches to Pass the input through.

  • A failed transform shows no data, never the raw value. A script that raises, or an expression that divides by zero, leaves the property empty with the binding-error marker.

Compared with Ignition Perspective ​

Perspective runs every binding on the gateway: each open session holds its property tree there, and the browser only draws it. Raylux runs tag lookups, expressions and simple transforms in the browser and keeps the gateway for tags, transforms on tag bindings, scripts and queries, so adding operator screens mostly costs the operators' browsers, not the gateway.

Perspective bindingRaylux
Tag (Direct, Indirect)Tag, Direct and Indirect
Tag, Expression mode (path built by an expression)Not yet; use {view.params.X} in the path or an Indirect binding
PropertyProperty
ExpressionExpression
Expression StructureNot yet
QueryQuery (named queries, polled)
Tag HistoryHistory (one tag; several tags with aliases is planned)
HTTPNot yet; use a gateway script with raylux.net writing a tag
runScript() in an expressionScript binding
Map, Format, Expression, Script transformsAll four, plus Node

How these numbers were measured ​

  • Machine: AMD Ryzen 7 5800X (8 cores, 16 threads), 31 GB RAM, Ubuntu 26.04, with other development work running alongside. Nexus built as Release from dev at commit 3ea5a186 (2026.25 in progress), GCC 16; Chrome headless, one tab. The 1 Hz browser runs used Spectrum from that commit; the 10 Hz runs, the 1 Hz Property + Format rows and the second of each 1 Hz Expression range used it plus this page's time-zone cache fix.
  • Tags: 1000 tags whose value is the gateway's clock (ms, mod 10⁷) when they changed, so every frame and every label carries its own timestamp. At 1 Hz they are expression tags now() % 10000000; at 10 Hz, memory tags written by a 100 ms gateway timer script (a now() expression tag does not tick faster than about once a second in this version).
  • Per-run CPU per evaluation (the "about 3 ms" figures) is derived: Nexus CPU minus the 11% baseline, divided by the measured updates per second.
  • Gateway side: a WebSocket client subscribes the way Spectrum does, including Spectrum's one-request-in-flight and 120 ms rules for script work, and reads latency off each frame. CPU is the Nexus process's own time.
  • Browser side: a real Spectrum page per screen, published alone, opened anonymously like a kiosk. Latency is to the DOM update; drawing adds up to one more frame (17 ms at 60 Hz). Main-thread share is Chrome's task time over 15 seconds after a 5-second warm-up.
  • Engine costs: npx vitest bench --run src/bench/bindingCost.bench.ts in web/. Run-to-run spread on a busy machine was up to 2×.
  • Re-run all of it: tools/bench/bindings/run-matrix.sh in the source tree (its header lists the arguments).