Skip to content

Commit

Permalink
Merge pull request #125 from saalfeldlab/perf/skipIsFile
Browse files Browse the repository at this point in the history
perf: skip file exists for `getAttributes`
  • Loading branch information
bogovicj authored Jul 15, 2024
2 parents 1630a27 + f59af0e commit 78e0349
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,10 @@ default JsonElement getAttributes(final String pathName) throws N5Exception {
final String groupPath = N5URI.normalizeGroupPath(pathName);
final String attributesPath = absoluteAttributesPath(groupPath);

if (!getKeyValueAccess().isFile(attributesPath))
return null;

try (final LockedChannel lockedChannel = getKeyValueAccess().lockForReading(attributesPath)) {
return GsonUtils.readAttributes(lockedChannel.newReader(), getGson());
} catch (final N5Exception.N5NoSuchKeyException e) {
return null;
} catch (final IOException | UncheckedIOException e) {
throw new N5IOException("Failed to read attributes from dataset " + pathName, e);
}
Expand Down

0 comments on commit 78e0349

Please sign in to comment.