Poco icon indicating copy to clipboard operation
Poco copied to clipboard

代码里面有exists()执行速度慢

Open journey1989 opened this issue 3 years ago • 0 comments

描述问题bug for i in range(1000000):
start = time.perf_counter() if poco('包名:id/iv_answer_red_pack').exists():

        one = ('包名:id/txt_select_one')
        two = ('包名:id/txt_select_tow')
        l = [one, two]
        
        poco(random.choice(l)).click()
        end = time.perf_counter()
        c = end - start
        print('运行时间间隔:', c , '\n')
        swipe([862,1551],[730,309],duration=0.1)
else:
    stop_app('包名')
    start_app('包名')
    sleep(4)

复现步骤

预期效果 快速执行

相关截图 以下代码里有exists()从判断开始,到点击元素时间间隔,以秒为单位 运行时间间隔: 25.35569645 运行时间间隔: 22.75342804 运行时间间隔: 15.481392041 运行时间间隔: 22.667031471 运行时间间隔: 5.12884205200001 运行时间间隔: 18.414016625000002 运行时间间隔: 4.045270825000003 运行时间间隔: 13.841773601 运行时间间隔: 22.509312025 以下代码里没有exists(),以秒为单位 运行时间间隔: 7.2062106539999995 运行时间间隔: 5.1110016940000005 运行时间间隔: 12.338673094 运行时间间隔: 9.402406765000002 运行时间间隔: 4.090974056999997 运行时间间隔: 4.671641758 运行时间间隔: 3.4989258230000004 运行时间间隔: 3.867417794000005

python 版本: python3.9

poco 版本: 1.2.3 pocoui 版本: 1.0.84

设备:

型号: vivo x20 系统:Android 8.1 其他相关环境信息 无

journey1989 avatar Dec 01 '21 02:12 journey1989