Skip to content

Commit

Permalink
* Cache result of FSStore._fsspec_installed (#1581)
Browse files Browse the repository at this point in the history
Prevent runtime-overhead in doing this check multiple times
  • Loading branch information
ph03 committed Dec 5, 2023
1 parent 79e80b3 commit 25dbeed
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Docs
Maintenance
~~~~~~~~~~~

* Cache result of ``FSStore._fsspec_installed()``.
By :user:`Janick Martinez Esturo <ph03>` :issue:`1581`.

* Extend copyright notice to 2023.
By :user:`Jack Kelly <JackKelly>` :issue:`1528`.

Expand Down
2 changes: 2 additions & 0 deletions zarr/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import zipfile
from collections import OrderedDict
from collections.abc import MutableMapping
from functools import lru_cache
from os import scandir
from pickle import PicklingError
from threading import Lock, RLock
Expand Down Expand Up @@ -1540,6 +1541,7 @@ def clear(self):
self.map.clear()

@classmethod
@lru_cache(maxsize=None)
def _fsspec_installed(cls):
"""Returns true if fsspec is installed"""
import importlib.util
Expand Down

0 comments on commit 25dbeed

Please sign in to comment.