Skip to content

Laggy lasso-selection #6548

Description

@nullstd

ALL software version info

(this library, plus any other relevant software, e.g. bokeh, python, notebook, OS, browser, etc should be added within the dropdown below.)

Software Version Info
Python 3.11.3
holoviews 1.19.0

Description of expected behavior and the observed behavior

lasso-select is quite laggy.

Initially I found the issue at the latest version 1.20.2. After some investigation I found it's related to the change from #6168.
Simply replace the same file with https://github.com/holoviz/holoviews/blob/f81533a4619f689bf4216f6c4013f25b6e9997d2/holoviews/plotting/bokeh/callbacks.py resolves the issue.

Complete, minimal, self-contained example code that reproduces the issue

It's easy to reproduce with the example code from https://holoviews.org/reference/streams/bokeh/point_selection1D.html

import numpy as np

import holoviews as hv
from holoviews import streams

hv.extension('bokeh')


# Declare some points
points = hv.Points(np.random.randn(1000,2 ))

# Declare points as source of selection stream
selection = streams.Selection1D(source=points)

# Write function that uses the selection indices to slice points and compute stats
def selected_info(index):
    selected = points.iloc[index]
    if index:
        label = 'Mean x, y: {:.3f}, {:.3f}'.format(*tuple(selected.array().mean(axis=0)))
    else:
        label = 'No selection'
    return selected.opts(color="red", title=label)

# Combine points and DynamicMap
points.opts(tools=["lasso_select"])+ hv.DynamicMap(selected_info, streams=[selection])

Just use lasso-select tool to do some selection, you can see the right chart is quite slow to show the result.

Stack traceback and/or browser JavaScript console output

Screenshots or screencasts of the bug in action

  • I may be interested in making a pull request to address this

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions