Commit 107f26da authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Preallocate properly sized map for inode.Children().

parent c3305938
...@@ -87,7 +87,7 @@ func (n *Inode) AnyFile() (file File) { ...@@ -87,7 +87,7 @@ func (n *Inode) AnyFile() (file File) {
func (n *Inode) Children() (out map[string]*Inode) { func (n *Inode) Children() (out map[string]*Inode) {
n.treeLock.RLock() n.treeLock.RLock()
out = map[string]*Inode{} out = make(map[string]*Inode, len(n.children))
for k, v := range n.children { for k, v := range n.children {
out[k] = v out[k] = v
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment