Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x AWS与本地主机上的可变时间睡眠(X.XX)FPS结果_Python 3.x_Amazon Web Services - Fatal编程技术网

Python 3.x AWS与本地主机上的可变时间睡眠(X.XX)FPS结果

Python 3.x AWS与本地主机上的可变时间睡眠(X.XX)FPS结果,python-3.x,amazon-web-services,Python 3.x,Amazon Web Services,我的异步脚本有一个主循环,在本地机器上每秒运行150000次迭代,在AWS实例(WindowsAMI,Python3.7)上每秒运行大约180000次迭代 当我在这个循环中引入time.sleep(1/X)时,我设法在本地主机上很好地控制它。例如: while t - tzero < settings.main_loop_seconds: for singleobject in iterable: singleobject.process()

我的异步脚本有一个主循环,在本地机器上每秒运行150000次迭代,在AWS实例(WindowsAMI,Python3.7)上每秒运行大约180000次迭代

当我在这个循环中引入time.sleep(1/X)时,我设法在本地主机上很好地控制它。例如:

while t - tzero < settings.main_loop_seconds:
    for singleobject in iterable:
        singleobject.process()     
        t= time.time()
        time.sleep(1/10000)  
        """with this I expect a maximum of 10000 iterations per second, and with the time lost to 'process' I get an actual 6500 iterations per second. As expected."""
        loopcounter += 1
        """ I reset this loopcounter to 0 from another thread (using threading.Timer)  It is used for logging the number of loops per second.
而t-tzero
现在的问题是,在AWS上,相同的代码,只是在时间上更改了“X”。sleep(1/X)

X=1#我每秒得到一个循环

X=10#我每秒有9个循环

X=100#我每秒得到64个循环

X=1000#我每秒得到64个循环

X=10000#我每秒得到64个循环

X=100000#我每秒得到64个循环

有人能解释一下这种行为吗?谢谢