summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-06-06 01:51:30 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2017-06-06 01:51:30 (GMT)
commit1b45e46cef6ea7f66a4ca2ab98dc293b43e95cc5 (patch)
treec25cb70678f491aabaeee760964a9ef45793dd56
parentedf31b7f2dc4b46f3bafcdcfc0052be12c0c0064 (diff)
downloadSCons-1b45e46cef6ea7f66a4ca2ab98dc293b43e95cc5.zip
SCons-1b45e46cef6ea7f66a4ca2ab98dc293b43e95cc5.tar.gz
SCons-1b45e46cef6ea7f66a4ca2ab98dc293b43e95cc5.tar.bz2
Performance: rewrite some central Node code based on hints on fastest uniquifiers for python from: https://www.peterbe.com/plog/uniqifiers-benchmark. In my tests yields about 15% speedup on Null Incremental build. Shows about the same on ElectricCloud scons benchmark
-rw-r--r--src/engine/SCons/Node/__init__.py42
1 files changed, 13 insertions, 29 deletions
diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py
index f7d2082..0409d3b 100644
--- a/src/engine/SCons/Node/__init__.py
+++ b/src/engine/SCons/Node/__init__.py
@@ -1136,38 +1136,22 @@ class Node(object, with_metaclass(NoSlotsPyPy)):
binfo.bactsig = SCons.Util.MD5signature(executor.get_contents())
if self._specific_sources:
- sources = []
- for s in self.sources:
- if s not in ignore_set:
- sources.append(s)
+ sources = [ s for s in self.sources if not s in ignore_set]
+
else:
sources = executor.get_unignored_sources(self, self.ignore)
+
seen = set()
- bsources = []
- bsourcesigs = []
- for s in sources:
- if not s in seen:
- seen.add(s)
- bsources.append(s)
- bsourcesigs.append(s.get_ninfo())
- binfo.bsources = bsources
- binfo.bsourcesigs = bsourcesigs
-
- depends = self.depends
- dependsigs = []
- for d in depends:
- if d not in ignore_set:
- dependsigs.append(d.get_ninfo())
- binfo.bdepends = depends
- binfo.bdependsigs = dependsigs
-
- implicit = self.implicit or []
- implicitsigs = []
- for i in implicit:
- if i not in ignore_set:
- implicitsigs.append(i.get_ninfo())
- binfo.bimplicit = implicit
- binfo.bimplicitsigs = implicitsigs
+ binfo.bsources = [s for s in sources if s not in seen and not seen.add(s)]
+ binfo.bsourcesigs = [s.get_ninfo() for s in binfo.bsources]
+
+
+ binfo.bdepends = self.depends
+ binfo.bdependsigs = [d.get_ninfo() for d in self.depends if d not in ignore_set]
+
+ binfo.bimplicit = self.implicit or []
+ binfo.bimplicitsigs = [i.get_ninfo() for i in binfo.bimplicit if i not in ignore_set]
+
return binfo