summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Node/FS.py
diff options
context:
space:
mode:
authorLudwig Hähne <pankrat@tigris.org>2009-02-09 21:17:56 (GMT)
committerLudwig Hähne <pankrat@tigris.org>2009-02-09 21:17:56 (GMT)
commit09bbbf9c75c93b3cf73ef3cca2d996fc131cc650 (patch)
tree6440df34ae37d7c67c83e4196d73895dd6fc35fd /src/engine/SCons/Node/FS.py
parent1e725d35dba7295ec9ee660f60f643abe0308fb3 (diff)
downloadSCons-09bbbf9c75c93b3cf73ef3cca2d996fc131cc650.zip
SCons-09bbbf9c75c93b3cf73ef3cca2d996fc131cc650.tar.gz
SCons-09bbbf9c75c93b3cf73ef3cca2d996fc131cc650.tar.bz2
Issue 2181: intern file-names to save memory
Diffstat (limited to 'src/engine/SCons/Node/FS.py')
-rw-r--r--src/engine/SCons/Node/FS.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py
index 5a2e1aa..fa0a9ed 100644
--- a/src/engine/SCons/Node/FS.py
+++ b/src/engine/SCons/Node/FS.py
@@ -552,22 +552,24 @@ class Base(SCons.Node.Node):
if __debug__: logInstanceCreation(self, 'Node.FS.Base')
SCons.Node.Node.__init__(self)
- self.name = name
- self.suffix = SCons.Util.splitext(name)[1]
+ # Filenames and paths are probably reused and are intern'ed to
+ # save some memory.
+ self.name = intern(name)
+ self.suffix = intern(SCons.Util.splitext(name)[1])
self.fs = fs
assert directory, "A directory must be provided"
- self.abspath = directory.entry_abspath(name)
- self.labspath = directory.entry_labspath(name)
+ self.abspath = intern(directory.entry_abspath(name))
+ self.labspath = intern(directory.entry_labspath(name))
if directory.path == '.':
- self.path = name
+ self.path = intern(name)
else:
- self.path = directory.entry_path(name)
+ self.path = intern(directory.entry_path(name))
if directory.tpath == '.':
- self.tpath = name
+ self.tpath = intern(name)
else:
- self.tpath = directory.entry_tpath(name)
+ self.tpath = intern(directory.entry_tpath(name))
self.path_elements = directory.path_elements + [self]
self.dir = directory
@@ -612,7 +614,7 @@ class Base(SCons.Node.Node):
except KeyError:
pass
result = self._get_str()
- self._memo['_save_str'] = result
+ self._memo['_save_str'] = intern(result)
return result
def _get_str(self):