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:
Max Horn 2006-04-07 11:47:58 +00:00
parent 00a4ca0224
commit 67fda4ece5

View file

@ -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)