Skip to content

Commit 25dbeed

Browse files
authored
* Cache result of FSStore._fsspec_installed (#1581)
Prevent runtime-overhead in doing this check multiple times
1 parent 79e80b3 commit 25dbeed

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

docs/release.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ Docs
4343
Maintenance
4444
~~~~~~~~~~~
4545

46+
* Cache result of ``FSStore._fsspec_installed()``.
47+
By :user:`Janick Martinez Esturo <ph03>` :issue:`1581`.
48+
4649
* Extend copyright notice to 2023.
4750
By :user:`Jack Kelly <JackKelly>` :issue:`1528`.
4851

zarr/storage.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import zipfile
2929
from collections import OrderedDict
3030
from collections.abc import MutableMapping
31+
from functools import lru_cache
3132
from os import scandir
3233
from pickle import PicklingError
3334
from threading import Lock, RLock
@@ -1540,6 +1541,7 @@ def clear(self):
15401541
self.map.clear()
15411542

15421543
@classmethod
1544+
@lru_cache(maxsize=None)
15431545
def _fsspec_installed(cls):
15441546
"""Returns true if fsspec is installed"""
15451547
import importlib.util

0 commit comments

Comments
 (0)