diff options
author | Mathew Robinson <chasinglogic@gmail.com> | 2019-08-19 17:37:12 (GMT) |
---|---|---|
committer | Mathew Robinson <chasinglogic@gmail.com> | 2019-08-19 18:26:10 (GMT) |
commit | 7914dc4b0851d54df467842364b76cbe23336f09 (patch) | |
tree | 242c833788034e8974abcd45735c3e7451d4ad62 /src/engine/SCons | |
parent | ce8f7eccdbcb626baa4a036dd8230268a5c35192 (diff) | |
download | SCons-7914dc4b0851d54df467842364b76cbe23336f09.zip SCons-7914dc4b0851d54df467842364b76cbe23336f09.tar.gz SCons-7914dc4b0851d54df467842364b76cbe23336f09.tar.bz2 |
Improve threading performance by sharing NodeInfo across threads
Diffstat (limited to 'src/engine/SCons')
-rw-r--r-- | src/engine/SCons/Node/FSTests.py | 7 | ||||
-rw-r--r-- | src/engine/SCons/Node/__init__.py | 8 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 72eaba7..eddfdf0 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -2545,11 +2545,10 @@ class FileTestCase(_tempdirTestCase): def get_ninfo(self): """ mocked to ensure csig will equal the filename""" - try: - return self.ninfo - except AttributeError: - self.ninfo = FakeNodeInfo(self.name, self.timestamp) + if self.ninfo is not None: return self.ninfo + self.ninfo = FakeNodeInfo(self.name, self.timestamp) + return self.ninfo def get_csig(self): ninfo = self.get_ninfo() diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 572465f..daf79ba 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -614,6 +614,7 @@ class Node(object, with_metaclass(NoSlotsPyPy)): self._func_rexists = 1 self._func_get_contents = 0 self._func_target_from_source = 0 + self.ninfo = None self.clear_memoized_values() @@ -1131,11 +1132,10 @@ class Node(object, with_metaclass(NoSlotsPyPy)): return ninfo def get_ninfo(self): - try: - return self.ninfo - except AttributeError: - self.ninfo = self.new_ninfo() + if self.ninfo is not None: return self.ninfo + self.ninfo = self.new_ninfo() + return self.ninfo def new_binfo(self): binfo = self.BuildInfo() |