Real-world Python code 700 times slower than C
Skip Montanaro
skip at pobox.com
Sat Jan 5 13:59:57 EST 2002
Paul> Looking at the programs, I would suspect that most of the
Paul> difference is that Python has to allocate and free the array
Paul> 100000 times, but the C program doesn't.
No, that's not the difference. The Python code Brent posted only allocates
the array once:
def main():
array = [0]*10000
for i in xrange(100):
Ramp(array, 10000, 0.0, 1.0)
--
Skip Montanaro (skip at pobox.com - http://www.mojam.com/)
More information about the Python-list
mailing list