Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved performance of setting/updating series data #866

Merged
merged 6 commits into from
Oct 12, 2021

Conversation

timocov
Copy link
Contributor

@timocov timocov commented Oct 11, 2021

Type of PR: enhancement

PR checklist:

Overview of change:

Checked on 2M data items:

  • setData was improved by up to ~20%
  • update now instant, even with 2M previously added points takes less than 1ms (previously it might take 300-500ms)

Also, probably with this changes memory consumption was reduced as well since now we're sharing the same objects between the "client" and the "server", but I didn't measure it (probably it is not noticeable ¯_(ツ)_/¯).

And since the code to merge data was removed from PlotList, even with some new code in DataLayer the total size was reduced a bit 🙂

- Reuse the same objects on client & data layer side (they are immutable for client side)
- Avoid iterating Map - iterating array is much faster that Map (_cleanupPointsData)
- Clearing a map object is faster than removing one by one (setSeriesData)
- We could save a reference to internal data to access it instantly (pointData)
- Provided first changed point index so the client can use it to make optimizations (time scale, tick marks)
- Do not remove already generated unchanged tick marks (TickMarks)
…ected

We can bu sure that points aren't changed if no points was removed and no points was added.
Otherwise we can fallback to the default "full update".
@timocov timocov requested a review from kirchet October 11, 2021 23:25
@timocov timocov merged commit aa21baa into master Oct 12, 2021
@timocov timocov deleted the fix838-apply-data-perf branch October 12, 2021 13:16
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.

Improve performance of updating data
2 participants