在鲲鹏920 arm64 linux上 Python 2.7.12 (default, Mar 6 2020, 01:18:13) [GCC 5.4.0 20160609] on linux2 >>> t=time.time();f3(10**8);print(time.time()-t) 724475280152 26.457449913 再用pypy arm版 Python 3.7.9 (7e6e2bb30ac5, Nov 18 2020, 12:47:35) [PyPy 7.3.3-beta0 with GCC 7.5.0] on linux ./pypy3 test.py 724475280152 1.486065149307251
单个质因数的平方和 >>>> s=0 >>>> for i in[4,16,64,9,81,25,49]:s+=100//i*i >>>> s 638
pypy64更快 https://buildbot.pypy.org/nightly/ Python 3.7.9 (f011a9a7f2e1, Dec 20 2020, 22:51:02) [PyPy 7.3.4-alpha0 with MSC v.1927 64 bit (AMD64)] on win32 >>>> t=time.time();f3(10**8);print(time.time()-t) 724475280152 2.0510029792785645
使用pypy Python 3.7.9 (7e6e2bb30ac5, Nov 18 2020, 12:05:16) [PyPy 7.3.3-beta0 with MSC v.1927 32 bit] on win32 >>>> t=time.time();f3(10**8);print(time.time()-t) 724475280152 5.47701096534729
3.91.不行,3.10.0a4却可以 d:\python310>python Python 3.10.0a4 (tags/v3.10.0a4:445f7f5, Jan 4 2021, 19:36:35) [MSC v.1928 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>