apple/turicreate
Voir sur GitHubInefficient implementation on checking if path is a s3 directory
Open
#3 049 ouverte le 14 mars 2020
S3good first issue
Métriques du dépôt
- Stars
- (11 135 stars)
- Métriques de merge PR
- (Aucune PR mergée en 30 j)
Description
our current implementation of s3 is_directory is to exhaust all keys under a certain URL (a.k.a, prefix, "folder" or "group") and compare the URL with each item returned, e.g., Contents[Key] and CommonPrefixes. This is a bad practice if the URL contains many keys and the comparison is linear O(n).
Besides that, is_directory is widely used in our codebase, not to mention the time complexity, the network delay will be observable.
A solution should be,
- head on URL assuming it's an object. If 404, then
- list-objects --with-delimiter and --max-items=1, and check the
CommonPrefixessection. You can provide an extra parameter to telllist_objects_implto do so by setting the max keys to return.