From f54f0f9499c53f5f5981e9397beb288f027aec31 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 7 Aug 2017 15:56:07 -0700 Subject: PR #344 - Use set() where applicable. In many cases this can lead to performance improvements --- src/CHANGES.txt | 1 + src/engine/SCons/Environment.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index fd41a75..b0e88c7 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -55,6 +55,7 @@ may cause rebuilds. In no case should rebuilds not happen. From Alexey Klimkin: - Use memoization to optimize PATH evaluation across all dependencies per node. (PR #345) + - Use set() where it is applicable (PR #344) From M. Limber: - Fixed msvs.py for Visual Studio Express editions that would report diff --git a/src/engine/SCons/Environment.py b/src/engine/SCons/Environment.py index 480a1d6..4f8e41b 100644 --- a/src/engine/SCons/Environment.py +++ b/src/engine/SCons/Environment.py @@ -167,7 +167,7 @@ def _set_SCANNERS(env, key, value): def _delete_duplicates(l, keep_last): """Delete duplicates from a sequence, keeping the first or last.""" - seen={} + seen=set() result=[] if keep_last: # reverse in & out, then keep first l.reverse() @@ -175,7 +175,7 @@ def _delete_duplicates(l, keep_last): try: if i not in seen: result.append(i) - seen[i]=1 + seen.add(i) except TypeError: # probably unhashable. Just keep it. result.append(i) -- cgit v0.12