Skip to content

[2269] ui-chart clones its whole series on every message - #2270

Open
n-lark wants to merge 1 commit into
mainfrom
2269-chart-clones
Open

n-lark wants to merge 1 commit into
mainfrom
2269-chart-clones

Conversation

@n-lark

@n-lark n-lark commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Description

Charts copied their entire history on every incoming message just to check it existed and to count points, so the longer a chart got, the slower every update became. This removes those copies. Nothing changes in what charts store or show.

Performance

The store work each chart message does is 95–98% lower. Measured on a chart with 4 lines of 1000 points receiving 16 messages a second (median of 7 runs):

X-Axis Limit Per message, main Per message, this PR Gain
By points (e.g. "OR 1000 points") 5.13 ms 0.25 ms ~20× faster
By time only (default, "last 1 hour") 2.43 ms 0.05 ms ~48× faster

At 16 messages a second that is about 82 ms of store work every second down to 4 ms when limited by points, and 39 ms down to under 1 ms when limited by time. The rest of the chart's per-message work is unchanged.

Test plan

  • has and keepLatestPerTopic make no cloneMessage calls
  • keepLatestPerTopic keeps the newest N per topic in order, treats a missing topic as one series, leaves the series alone under the limit, and ignores a widget holding a single message
  • get still returns a copy
  • Matches the removed ui_chart logic on 5,000 random series, including missing, empty and numeric topics
  • Line chart limited to 5 points with two lines: 5 per line in the store, 5 per line drawn live and after a reload, no console errors

Related Issue(s)

Closes #2269

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui-chart clones its whole series on every message

1 participant