Cache the root node (cause a major speedup on OSX, since by far the slowes part in the FS code over here is the getcwd call in getRoot() )
svn-id: r21667
This commit is contained in:
parent
00a4ca0224
commit
67fda4ece5
1 changed files with 11 additions and 2 deletions
|
@ -24,6 +24,10 @@
|
|||
#include "backends/fs/fs.h"
|
||||
#include "common/util.h"
|
||||
|
||||
|
||||
static AbstractFilesystemNode *_rootNode = 0;
|
||||
static int *_rootRefCount = 0;
|
||||
|
||||
FilesystemNode AbstractFilesystemNode::wrap(AbstractFilesystemNode *node) {
|
||||
FilesystemNode wrapper(node);
|
||||
return wrapper;
|
||||
|
@ -35,8 +39,13 @@ FilesystemNode::FilesystemNode(AbstractFilesystemNode *realNode) {
|
|||
}
|
||||
|
||||
FilesystemNode::FilesystemNode() {
|
||||
_realNode = getRoot();
|
||||
_refCount = new int(1);
|
||||
if (_rootNode == 0) {
|
||||
_rootNode = getRoot();
|
||||
_rootRefCount = new int(1);
|
||||
}
|
||||
_realNode = _rootNode;
|
||||
_refCount = _rootRefCount;
|
||||
++(*_refCount);
|
||||
}
|
||||
|
||||
FilesystemNode::FilesystemNode(const FilesystemNode &node)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue