Python speed 32 v 64 bit Windows issue
I've been having performance issues when moving apps between 32 bit windows 7 and 64 bit windows server 2008, both with similar processors. I wrote a trivial program to test memory allocation performance to see the difference. It shows that making lists on 64 takes almost 10 times as long as 32 bit windows. Using python 2.6.5 on 32 and 2.6.6 on 64. What could be causing the problem? I wrote a little 'c' program to do the same thing and it showed the 64 bit server going faster. So what is going wrong?
#silly python memory allocation test
from datetime import datetime
import random
d = datetime.now()
listo = [1] * 300000
del listo
print datetime.now()-d
d = datetime.now()
listo = [1] * 3000000
del listo
print datetime.now()-d
d = datetime.now()
listo = [1] * 30000000
print datetime.now()-d
result on 32
0:00:00.002000
0:00:00.024000
0:00:00.166000
result on 64
0:00:00.031000
0:00:00.156000
0:00:02.672000
Is there some outstanding problem with Python and memory peformance on 64 bit windows?
64 Windows 2008 R2 Server setup
4 CPU, 16GB Memory, 20GB C drive, 10GB/s Network Xeon X5570 @ 2.93GHz
开发者_Python百科32 Windows 7 pc
2 CPU, 2GB Memory, 500gb C drive, 1 Gb/s network Core 2 duo @ 3.00ghz
I don't know why it is so much longer, but a bit more time you should expect because in this example the program allocates double of the memory in the 64 bit mode, as in the 32 bit mode since python uses 32/64bit pointers in its lists.
This may be different in C when you are still using 32bit datatypes.
Problem is caused by use of virtural machine software on the windows server.
I had another problem with Python 2.7 and 64 bit. I run a program which in 32 bit Python gave memory overflow on a smaller computer. I was interested of if my big RAM would be used. And certainly it was. Up to maximum 10 GB and the machine hanged up. I had to switch of the power supply and restart the computer.
精彩评论