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

Reduce updating triggers for displays #66

Merged
merged 5 commits into from
Nov 22, 2023
Merged

Reduce updating triggers for displays #66

merged 5 commits into from
Nov 22, 2023

Conversation

hoxbro
Copy link
Member

@hoxbro hoxbro commented Nov 22, 2023

This will now only update the data of the display each time a refresh() is done and only refresh when selected_indexes is changed.

Something like this would run self.annotator.get_dataframe 5 times with each click on a curve. If I commented out the anno2 line, it would be 3 times. After this change, it will only run once, and not update when clicking (as the data has not changed).

from __future__ import annotations

import holoviews as hv
import panel as pn

from holonote.annotate import Annotator, SQLiteDB
from holonote.app import PanelWidgets

hv.extension("bokeh")

# connector = SQLiteDB(filename=":memory:")
connector = SQLiteDB(table_name="test_curves")

annotator = Annotator({"TIME": float}, fields=["description"], connector=connector)
anno1 = annotator * hv.Curve(range(10), kdims="TIME")
anno2 = annotator * hv.Curve(range(10)[::-1], kdims="TIME")
anno = anno1

b = PanelWidgets(annotator)
pn.Row(b, anno).servable()

@hoxbro hoxbro changed the title Small uptimization Small optimization Nov 22, 2023
@hoxbro hoxbro changed the title Small optimization Reduce updating triggers for displays Nov 22, 2023
@hoxbro hoxbro merged commit 0e5d700 into main Nov 22, 2023
15 checks passed
@hoxbro hoxbro deleted the small_uptimization branch November 22, 2023 16:24
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.

1 participant