[Scummvm-cvs-logs] SF.net SVN: scummvm: [21667] scummvm/trunk/backends/fs/fs.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Apr 7 04:49:01 CEST 2006
Revision: 21667
Author: fingolfin
Date: 2006-04-07 04:47:58 -0700 (Fri, 07 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21667&view=rev
Log Message:
-----------
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() )
Modified Paths:
--------------
scummvm/trunk/backends/fs/fs.cpp
Modified: scummvm/trunk/backends/fs/fs.cpp
===================================================================
--- scummvm/trunk/backends/fs/fs.cpp 2006-04-07 11:37:46 UTC (rev 21666)
+++ scummvm/trunk/backends/fs/fs.cpp 2006-04-07 11:47:58 UTC (rev 21667)
@@ -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() {
- _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)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list