summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-04-24 05:51:13 +0000
committerGreg Noel <GregNoel@tigris.org>2010-04-24 05:51:13 +0000
commit6a372812448d3462ac91d2c392f323b93df7e383 (patch)
treea4b9f900e52561a91e0c4509dc6c692492996b7f /bench
parentf7ac1212e72b65e2840b9b116b962e3872e30e8e (diff)
downloadscons-6a372812448d3462ac91d2c392f323b93df7e383.tar.gz
http://scons.tigris.org/issues/show_bug.cgi?id=2345
Comb out all code that supported earlier versions of Python. Most such code is in snippets of only a few lines and can be identified by having a Python version string in it. Such snippets add up; this combing pass probably got rid of over 500 lines of code.
Diffstat (limited to 'bench')
-rw-r--r--bench/bench.py1
-rw-r--r--bench/is_types.py52
-rw-r--r--bench/timeit.py8
3 files changed, 3 insertions, 58 deletions
diff --git a/bench/bench.py b/bench/bench.py
index a839ed65..3391f9d9 100644
--- a/bench/bench.py
+++ b/bench/bench.py
@@ -23,7 +23,6 @@
#
# This will allow (as much as possible) us to time just the code itself,
# not Python function call overhead.
-from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS
import getopt
import sys
diff --git a/bench/is_types.py b/bench/is_types.py
index 9cc397e5..0353dc8a 100644
--- a/bench/is_types.py
+++ b/bench/is_types.py
@@ -7,57 +7,7 @@
import types
from UserDict import UserDict
from UserList import UserList
-
-try:
- from UserString import UserString
-except ImportError:
- # "Borrowed" from the Python 2.2 UserString module
- # and modified slightly for use with SCons.
- class UserString:
- def __init__(self, seq):
- if isinstance(seq, str):
- self.data = seq
- elif isinstance(seq, UserString):
- self.data = seq.data[:]
- else:
- self.data = str(seq)
- def __str__(self): return str(self.data)
- def __repr__(self): return repr(self.data)
- def __int__(self): return int(self.data)
- def __long__(self): return long(self.data)
- def __float__(self): return float(self.data)
- def __complex__(self): return complex(self.data)
- def __hash__(self): return hash(self.data)
-
- def __cmp__(self, s):
- if isinstance(s, UserString):
- return cmp(self.data, s.data)
- else:
- return cmp(self.data, s)
- def __contains__(self, char):
- return char in self.data
-
- def __len__(self): return len(self.data)
- def __getitem__(self, index): return self.__class__(self.data[index])
- def __getslice__(self, start, end):
- start = max(start, 0); end = max(end, 0)
- return self.__class__(self.data[start:end])
-
- def __add__(self, other):
- if isinstance(other, UserString):
- return self.__class__(self.data + other.data)
- elif is_String(other):
- return self.__class__(self.data + other)
- else:
- return self.__class__(self.data + str(other))
- def __radd__(self, other):
- if is_String(other):
- return self.__class__(other + self.data)
- else:
- return self.__class__(str(other) + self.data)
- def __mul__(self, n):
- return self.__class__(self.data*n)
- __rmul__ = __mul__
+from UserString import UserString
InstanceType = types.InstanceType
DictType = dict
diff --git a/bench/timeit.py b/bench/timeit.py
index ca7e4706..199b7c93 100644
--- a/bench/timeit.py
+++ b/bench/timeit.py
@@ -43,12 +43,8 @@ cases. On Unix, you can use clock() to measure CPU time.
Note: there is a certain baseline overhead associated with executing a
pass statement. The code here doesn't try to hide it, but you should
be aware of it. The baseline overhead can be measured by invoking the
-program without arguments.
-
-The baseline overhead differs between Python versions! Also, to
-fairly compare older Python versions to Python 2.3, you may want to
-use python -O for the older versions to avoid timing SET_LINENO
-instructions.
+program without arguments. The baseline overhead differs between
+Python versions!
"""
try: