Skip to content

Optimize previews: redraw only changed elements when client updates #6

@Marek55S

Description

@Marek55S

Summary

Currently the preview components fully clear and redraw every time the parent state changes (new image, new units, changed header, etc.). This can be wasteful: many updates only change a small subset of the displayed data (for example, swapping the pixel buffer while axes, titles and layout remain identical). We should implement partial redraws so only changed elements (pixel data, axis range, color scale) are updated, reducing CPU work and improving responsiveness.

Motivation

  • Large images (megapixel) cause slow redraws and UI jank when fully re-rendered on every change.
  • Avoiding unnecessary DOM resets and histogram re-creation can significantly reduce CPU and memory churn.

Reproduction

  1. Load a large image and observe the JSROOT preview draw time.
  2. Modify only pixel data (apply small filter) or change a UI control that affects only scaling; observe full redraw cost.

Proposed changes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions