BSD当然要运行在RISC平台上,主要讨论但不限于 ARM,MIPS,PowerPC,SPARC
			
		
		
			- 
				
								unreal							
 
						- 银 Ag
 			
		- 帖子: 1089
 		- 注册时间: 2010-06-07  18:52
 		
		
						
						
		
		
						
						
													
							
						
									
						帖子
					
								由 unreal » 2016-01-11  18:16
			
			
			
			
			本测试仅供自娱自乐。正在学 python2.7.x 学到有点郁闷,拿来解闷玩一下~手头有PowerPC、ARMv7、MIPS64、MIPS64el 四种RISC处理器的机器,有单核、双核、单核x2 SMP 三种架构,应该对测试结果影响不大,因为代码绝对是单线程的~~处理器制程、出产年代、主频和内存、OS和PY版本也各不相同。数值单位是秒。
python代码:
代码: 全选
>>>import time
>>>def test():
       t1=time.time()
       for i in range(300000):pass
       print time.time()-t1
结果只取小数点后三位,数值去掉最高和最低的取最多的中间值。
- PowerPC7455 x2 SMP, 1Ghz, OpenBSD5.5, Python2.7.6 得分:0.108s
 
- MT6572(Cortex A7 *2core),1.2Ghz, Android4.2.2, Qpython1.2.2 得分:0.187s
 
- Octeon Plus *2core, 500Mhz, EdgeOS(Debian/mips64), Python2.7.3 得分:0.155s
 
- Loongson2F, 800Mhz, OpenBSD5.3, Python2.7.3 得分:0.288s
 
 
			
									
									
						 
		 
				
		
		 
	 
	
				
		
		
			- 
				
																			
								hyaska							 
						- 铜 Cu
 			
		- 帖子: 311
 		- 注册时间: 2010-12-10  16:11
 		
		
						
						
		
		
						
						
													
							
						
									
						帖子
					
								由 hyaska » 2016-01-27  19:26
			
			
			
			
			太不科学了,试试这个
代码: 全选
# Generate prime numbers
# Based on an article from http://dunningrb.wordpress.com/
 
import datetime, sys, math
 
# Function to print message
def print_prime(x):
  print " Prime : %7i " %x
 
# Function to search for prime numbers
# within number range
def find_primes(upper_limit):
  count = 0
  candidate = 3
  while(candidate <= upper_limit):
    trial_divisor = 2
    prime = 1 # assume it's prime
    while(trial_divisor**2 <= candidate and prime):
      if(candidate%trial_divisor == 0):
        prime = 0 # it isn't prime
      trial_divisor+=1
    candidate += 2
  return count
# Check if the script was called with a
# parameter. Use that as the upper limit
# of numbers to search
if len(sys.argv) != 2:
  upper_limit=1000000
else:
  upper_limit=int(sys.argv[1])
 
# Record the current time
startTime = datetime.datetime.now()
 
# Start the process
print ""
print "Starting ..."
print ""
count = find_primes(upper_limit)
print ""
 
# Measure and print the elapsed time
elapsed=datetime.datetime.now()-startTime
print " Found %d primes in %s" %(count,elapsed)
print ""
注意缩进
 
			
									
									
						 
		 
				
		
		 
	 
	
				
	
				
		
		
			- 
				
								unreal							
 
						- 银 Ag
 			
		- 帖子: 1089
 		- 注册时间: 2010-06-07  18:52
 		
		
						
						
		
		
						
						
													
							
						
									
						帖子
					
								由 unreal » 2016-03-04  13:40
			
			
			
			
			今天可以抽空测试。在winXP下把代码整理了下,py的缩排真是坑,UltraEdit理了一下,py2.7还是有报缩进不匹配,换用 Notepad++ 才理清。现在去午饭,待会再开机测测。
			
									
									
						 
		 
				
		
		 
	 
	
				
		
		
			- 
				
								unreal							
 
						- 银 Ag
 			
		- 帖子: 1089
 		- 注册时间: 2010-06-07  18:52
 		
		
						
						
		
		
						
						
													
							
						
									
						帖子
					
								由 unreal » 2016-03-04  18:49
			
			
			
			
			代码没看懂,每次run 50000的结果都是 Found 0 primes in 0:00:00.672000 (intel CoreDuo U2500 1.2GHz),我就取这个时间值了。每个cpu测10次,取最小值。
- PowerPC7455 x2 SMP, 1Ghz, OpenBSD5.5, Python2.7.6 得分:1.524192s
 
- MT6572(Cortex A7 *2core),1.2Ghz, Android4.2.2, Qpython1.2.2 得分:2.312982s
 
- Octeon Plus *2core, 500Mhz, EdgeOS(Debian/mips64), Python2.7.3 得分:3.093735s
 
- Loongson2F, 800Mhz, OpenBSD5.3, Python2.7.3 得分:2.291114s
 
看起来,仍然是PowerPC7455最高,龙芯2F第二了,OcetonPlus没有FPU 垫底了。
 
			
									
									
						 
		 
				
		
		 
	 
	
	
	
 
	
		在线用户
		正浏览此版面之用户: 没有注册用户 和 1 访客