Skip to content

Commit 86b4167

Browse files
martindurantdcherianIllviljan
authored
Reduce dask tokenization time (#8339)
* Reduce dask tokenization time * Add comment --------- Co-authored-by: Deepak Cherian <dcherian@users.noreply.github.com> Co-authored-by: Illviljan <14371165+Illviljan@users.noreply.github.com>
1 parent 8dddbca commit 86b4167

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

xarray/core/dataset.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,8 @@ def _maybe_chunk(
309309
# when rechunking by different amounts, make sure dask names change
310310
# by providing chunks as an input to tokenize.
311311
# subtle bugs result otherwise. see GH3350
312-
token2 = tokenize(name, token if token else var._data, chunks)
312+
# we use str() for speed, and use the name for the final array name on the next line
313+
token2 = tokenize(token if token else var._data, str(chunks))
313314
name2 = f"{name_prefix}{name}-{token2}"
314315

315316
from_array_kwargs = utils.consolidate_dask_from_array_kwargs(

0 commit comments

Comments
 (0)