Skip to content

Slow EV3 screen update in EV3 Python v2 #526

@ndward

Description

@ndward

ev3dev version: 4.14.61-ev3dev-2.2.2-ev3
ev3dev-lang-python version:
ii python3-ev3dev 1.2.0 all Python language bindings for ev3dev
ii python3-ev3dev2 2.0.0~beta1 all Python language bindings for ev3dev

This script seems to show that it takes more than 3s for the screen to update in EV3 Python v2:

#!/usr/bin/env python3
# v2
from ev3dev2.display import Display
from sys import stderr
from time import sleep, time

screen = Display()

start_time = time()
for i in range(10):
    screen.update()
    print(time()-start_time, file=stderr)

Result:
3.3111462593078613
6.4367356300354
9.531918287277222
12.596878051757812
15.702414512634277
18.824042558670044
21.96616840362549
25.0904278755188
28.212737321853638
31.273113012313843
Average update time 3.13s assuming other code takes insignificant time.

The Python 1 script below gives average update time of 0.73s, or more than four times faster than for v2:

#!/usr/bin/env python3
# v1
from ev3dev.ev3 import *
from sys import stderr
from time import sleep, time

screen = Screen()

start_time = time()
for i in range(10):
    screen.update()
    print(time()-start_time, file=stderr)

Times:
0.7801563739776611
1.5146124362945557
2.2300970554351807
2.974599599838257
3.658750534057617
4.398235082626343
5.121510028839111
5.818562984466553
6.541661977767944
7.269548177719116

Something wrong in the new version?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions