[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame.display.flip slow



‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Tuesday, February 18, 2020 3:50 PM, Nuno Maltez <nuno.lists@xxxxxxxxx> wrote:

> Hi
> I'm experiencing very slow frame rates on a particular set up and need some help to understand
> what may be causing it.
> On this machine, the code below has an avg fram rate of around 45fps.
> The profiling output is:
>
>    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
>         1    0.000    0.000    2.015    2.015 <string>:1(<module>)
>         1    0.001    0.001    2.015    2.015 fps_test.py:11(run)
>         1    0.000    0.000    2.015    2.015 {built-in method builtins.exec}
>         1    0.000    0.000    0.000    0.000 {built-in method builtins.print}
>         1    0.000    0.000    0.000    0.000 {built-in method builtins.sum}
>       100    1.977    0.020    1.977    0.020 {built-in method pygame.display.flip}
>         1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
>       100    0.031    0.000    0.031    0.000 {method 'fill' of 'pygame.Surface' objects}
>       100    0.000    0.000    0.000    0.000 {method 'get_fps' of 'Clock' objects}
>       100    0.006    0.000    0.006    0.000 {method 'tick' of 'Clock' objects}
> This is:
> Fedora 31
> Python 3.7.6
> Pygame 1.9.6 (I tried pygame 2.0.0.dev7 and it's the same)


Takes beautifully the 20 milliseconds you'd expect for a 50 Hz display. Use pygame.display.update() if you want to take care of the framerate yourself. :)

cheers!
mar77i



Sent with ProtonMail Secure Email.