This fix should significantly improve performance. Without it, every
call to node.metadata() caused the VFS to read the entire .bupm file
in order to (re)initialize the metadata for every entry in the
directory. Don't do that.
I thought I'd already implemented this, but apparently only in my
head.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
self._bupm = None
def _populate_metadata(self):
+ if self._metadata:
+ return
if not self._subs:
self._mksubs()
if not self._bupm:
return
meta_stream = self._bupm.open()
- self._metadata = metadata.Metadata.read(meta_stream)
+ dir_meta = metadata.Metadata.read(meta_stream)
for sub in self:
if not stat.S_ISDIR(sub.mode):
sub._metadata = metadata.Metadata.read(meta_stream)
+ self._metadata = dir_meta
def _mksubs(self):
self._subs = {}