DirectoryStore `.keys()` optimisation.
See original GitHub issueIt looks like the keys()
method of directory store reimplement a lot of the logic of os.walk()
that could be used to increase efficiency.
in particular using os.walk()
will directly return directory and files separately and will avoid the two extra expensive call to os.path.isfile(path)
, and os.path.isdir(path)
.
forming the keys will be a tiny bit less straightforward than current method as os.walk()
returns the full relative path you gave it whether or not you terminate it by a slash, so we might have to be careful with this.
(I also note that this methods does list os specific files, like .DStore.
. not sure this is on purpose.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Tutorial — zarr 2.13.3 documentation - Read the Docs
The zarr.convenience.open() function provides a convenient way to create a new persistent array or continue working with an existing array.
Read more >memmap reads from directory store · Issue #265 - GitHub
Anyway i feel im prematurely optimising as a distraction. ... def __getitem__(self, key): #this is not the right place for this but for ......
Read more >Optimising Python dictionary access code - Stack Overflow
On every iteration of my algorithm, a random subset of these nodes are chosen and propagate_distances_node() is called on them. This means the ......
Read more >Hibernate Search Reference Guide JBoss Enterprise Application ...
Most, if not all of the time, the property is the database primary key. ... environment or in clustered environments where the directory...
Read more >scipy.optimize.OptimizeResult.keys — SciPy v1.9.3 Manual
optimize.OptimizeResult.keys#. OptimizeResult.keys() → ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I do have a prototype which appear to be a bit faster on small zarr on my laptop.
Some tests do seem to rely on keys ordering though…
Notes,
os.walk()
may also return path with\
instead of/
,And yes
os.scandir
is used insideos.walk()