[Python-checkins] benchmarks: Use a list comprehension over list/imap.
brett.cannon
python-checkins at python.org
Mon Oct 1 01:17:34 CEST 2012
http://hg.python.org/benchmarks/rev/f12b4f8bcf29
changeset: 185:f12b4f8bcf29
user: Brett Cannon <brett at python.org>
date: Sun Sep 30 19:17:26 2012 -0400
summary:
Use a list comprehension over list/imap.
files:
performance/bm_spectral_norm.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/performance/bm_spectral_norm.py b/performance/bm_spectral_norm.py
--- a/performance/bm_spectral_norm.py
+++ b/performance/bm_spectral_norm.py
@@ -11,14 +11,15 @@
import itertools
import optparse
-from compat import imap, izip, xrange
+from compat import izip, xrange
import util
def eval_A(i, j):
return 1.0 / ((i + j) * (i + j + 1) // 2 + i + 1)
def eval_times_u(func, u):
- return list(imap(func, ((i,u) for i in xrange(len(list(u))))))
+ return [func((i,u)) for i in xrange(len(list(u)))]
+
def eval_AtA_times_u(u):
return eval_times_u(part_At_times_u, eval_times_u(part_A_times_u, u))
--
Repository URL: http://hg.python.org/benchmarks
More information about the Python-checkins
mailing list