Skip to content

Commit

Permalink
Various fixes for bokeh static_source optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 6, 2017
1 parent 53911bf commit 28350a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,11 +798,11 @@ def update_frame(self, key, ranges=None, plot=None, element=None, empty=False):
# Cache frame object id to skip updating data if unchanged
previous_id = self.handles.get('previous_id', None)
if self.batched:
current_id = sum(element.traverse(lambda x: id(x.data), [Element]))
current_id = sum(element.traverse(lambda x: id(x)+id(x.data), [Element]))
else:
current_id = id(element.data)
current_id = id(element) + id(element.data)
self.handles['previous_id'] = current_id
self.static_source = self.dynamic and (current_id == previous_id)
self.static_source = (self.dynamic and (current_id == previous_id))
if self.batched:
data, mapping = self.get_batched_data(element, ranges, empty)
else:
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def sync_sources(self):
from the same object.
"""
get_sources = lambda x: (id(x.current_frame.data), x)
filter_fn = lambda x: (x.shared_datasource and x.current_frame and
filter_fn = lambda x: (x.shared_datasource and x.current_frame is not None and
not isinstance(x.current_frame.data, np.ndarray)
and 'source' in x.handles)
data_sources = self.traverse(get_sources, [filter_fn])
Expand Down
7 changes: 4 additions & 3 deletions holoviews/plotting/bokeh/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ def current_handles(self):
if self.static and not self.dynamic:
return handles


element = self.current_frame
previous_id = self.handles.get('previous_id', None)
current_id = id(self.current_frame.data) if self.current_frame else None
current_id = None if self.current_frame is None else id(element)+id(element.data)
for handle in self._update_handles:
if (handle == 'source' and self.dynamic and
current_id == previous_id):
if (handle == 'source' and self.dynamic and current_id == previous_id):
continue
if handle in self.handles:
handles.append(self.handles[handle])
Expand Down

0 comments on commit 28350a3

Please sign in to comment.