Skip to content

Commit

Permalink
Small fixes for plot_id optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 28, 2017
1 parent bdc69a7 commit 43b3c38
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions holoviews/core/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
from ..core.util import (basestring, sanitize_identifier,
group_sanitizer, label_sanitizer, max_range,
find_range, dimension_sanitizer, OrderedDict,
bytes_to_unicode, unicode, dt64_to_dt, unique_array)
bytes_to_unicode, unicode, dt64_to_dt, unique_array,
builtin)
from .options import Store, StoreOptions
from .pprint import PrettyPrinter

obj_id = id
# Alias parameter support for pickle loading

ALIASES = {'key_dimensions': 'kdims', 'value_dimensions': 'vdims',
Expand Down Expand Up @@ -489,7 +489,7 @@ def __init__(self, data, id=None, plot_id=None, **params):
"""
self.data = data
self.id = id
self._plot_id = plot_id or obj_id(self)
self._plot_id = plot_id or builtin.id(self)
if isinstance(params.get('label',None), tuple):
(alias, long_name) = params['label']
label_sanitizer.add_aliases(**{alias:long_name})
Expand Down
5 changes: 5 additions & 0 deletions holoviews/core/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
except:
from collections import OrderedDict

try:
import builtin
except:
import builtins as builtin

datetime_types = (np.datetime64, dt.datetime)

try:
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -804,7 +804,7 @@ 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: x._plot_id, [Element]))
current_id = tuple(element.traverse(lambda x: x._plot_id, [Element]))
else:
current_id = element._plot_id
self.handles['previous_id'] = current_id
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/tabular.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def current_handles(self):

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

0 comments on commit 43b3c38

Please sign in to comment.