New submission from Andreas Kloeckner:
The attached program uncovers a two-fold performance regression in
Python 2.5 with respect to Python 2.4. Below, the "element-wise" case
goes from 2.5 seconds in 2.4 to about 4 in 2.5. Since that's a pretty
serious increase, I thought I'd point it out.
$ python2.5 periodic_test.py
elwise 3.91989398003
collective 1.21577095985
$ python2.4 periodic_test.py
elwise 2.50014710426
tuplewise 1.35589385033
----------
components: Interpreter Core, Library (Lib)
files: periodic_test.py
messages: 55366
nosy: inducer
severity: normal
status: open
title: Performance regression in 2.5
type: behavior
versions: Python 2.5
__________________________________
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1045>
__________________________________
"""This benchmark informs the decision whether to do matching of periodic
face pairs by lookup of tuples of vertices or each vertex separately.
At the time of this writing, and under Python 2.5, tuplewise lookup has
about a 1-to-4 advantage.
"""
def main():
from random import choice
from time import time
N = 50
base_set = range(N)
# generate correspondence
corr = dict((b, choice(base_set)) for b in base_set)
# generate tuples
TS = 3
N_TUP = 500000
tups = [tuple(choice(base_set) for i in range(TS))
for j in range(N_TUP)]
tup_corr = {}
for tup in tups:
mapped = tuple(corr[t] for t in tup)
tup_corr[tup] = mapped
ITER = 500000
start = time()
for i in xrange(ITER):
tup = choice(tups)
mapped = tuple(corr[t] for t in tup)
print "elwise", time()-start
start = time()
for i in xrange(ITER):
tup = choice(tups)
mapped = tup_corr[tup]
print "tuplewise", time()-start
if __name__ == "__main__":
main()
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com