-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Performance degradation with Pygame 2.0.0 and 2.1.0 on Raspberry Pi #2883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Try switching to the SDL 2 blitter with the environment variable. If you
get no visual artefacts in your game you are golden.
…On Sat, 4 Dec 2021, 11:18 salem-ok, ***@***.***> wrote:
*Environment:*
You can get some of this info from the text that pops up in the console
when you run a pygame program.
- *Operating system*: Raspbian GNU/Linux 10 (buster)
- *Python version* : 3.7.3
- *SDL version* : 2.0.0
- *PyGame version*: 2.0.0 same issue reproduced on 2.1.0
- *Relevant hardware* : Raspberry Pi 4 4Gb RAM
*Current behavior:*
My game runs at 18 FPS on average with pygame 2.0.0 and 2.1.0
*Expected behavior:*
My game runs at 30 FPS on average with pygame 1.9.4
*Screenshots*
N/A
*Steps to reproduce:*
Please explain the steps required to duplicate the issue, especially if
you are able to provide a sample application.
if the bug is caused by a specific file (image, font, sound, level, please
upload it as an attachment
1. Clone my repository https://github.com/salem-ok/PySprint.git
2. run pysprint.py with various versions of pygame on a Raspberry Pi 4
running Buster
3. Check the FPS counter at bottom right during a race
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2883>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADGDGGXMQDSIWIMCA4NWCZLUPH2HVANCNFSM5JLO3NHA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
This variable is the one I mean:
PYGAME_BLEND_ALPHA_SDL2
It has some visual differences with the pygame 1/default blitter, but many users won't notice.
Docs on pygame env variables are here:
https://www.pygame.org/docs/ref/pygame.html
…On Sat, 4 Dec 2021, 12:07 Dan Lawrence, ***@***.***> wrote:
Try switching to the SDL 2 blitter with the environment variable. If you
get no visual artefacts in your game you are golden.
On Sat, 4 Dec 2021, 11:18 salem-ok, ***@***.***> wrote:
> *Environment:*
>
> You can get some of this info from the text that pops up in the console
> when you run a pygame program.
>
> - *Operating system*: Raspbian GNU/Linux 10 (buster)
> - *Python version* : 3.7.3
> - *SDL version* : 2.0.0
> - *PyGame version*: 2.0.0 same issue reproduced on 2.1.0
> - *Relevant hardware* : Raspberry Pi 4 4Gb RAM
>
> *Current behavior:*
> My game runs at 18 FPS on average with pygame 2.0.0 and 2.1.0
>
> *Expected behavior:*
>
> My game runs at 30 FPS on average with pygame 1.9.4
>
> *Screenshots*
>
> N/A
>
> *Steps to reproduce:*
>
> Please explain the steps required to duplicate the issue, especially if
> you are able to provide a sample application.
> if the bug is caused by a specific file (image, font, sound, level,
> please upload it as an attachment
>
> 1. Clone my repository https://github.com/salem-ok/PySprint.git
> 2. run pysprint.py with various versions of pygame on a Raspberry Pi
> 4 running Buster
> 3. Check the FPS counter at bottom right during a race
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#2883>, or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ADGDGGXMQDSIWIMCA4NWCZLUPH2HVANCNFSM5JLO3NHA>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
>
|
hmm, while the new blitter might be responsible for some of the slowdown on the pi (due to the fact that neon optimisations are disabled by default), I don't think it fully accounts for the slowdown on the pi, there might be more stuff that causes this performance degrade. I will do some benchmarking and profiling on my pi later and post my findings here |
Ok, I've done some benchmarking and profiling on my pi3 that runs PiOS bullseye (latest) and the results are not-so-good for pygame. On the pi
To investigate the reason for the slowdown and eliminate any other sources of potential slowdown, I profile the game (using pygame 2.1.0 at this point with pygame blitter at default without SIMD) and indeed, Comparing time per call of |
There was a bit of memory jogging over on the discord in which we recalled that SDL disabled their arm SIMD blitters by default a while ago (2.0.14 maybe?), and they haven't been re-enabled again yet. So, if you want the best Arm/Pi performance, and don't care about visual impacts/differences to non-arm, then you need to either: a) build SDL 2 yourself on the Pi with the arm blitters enabled. then use the pygame environment variable You could also explore using pre-multiplied alpha-blending ( Relevant SDL PRs & issue here: Arm SIMD blitters disabled: libsdl-org/SDL@363fd52 Ongoing work to re-enable them: libsdl-org/SDL#4484 At least that should do it. |
Environment:
You can get some of this info from the text that pops up in the console when you run a pygame program.
Current behavior:
My game runs at 18 FPS on average with pygame 2.0.0 and 2.1.0
Expected behavior:
My game runs at 30 FPS on average with pygame 1.9.4
Screenshots
N/A
Steps to reproduce:
Please explain the steps required to duplicate the issue, especially if you are able to provide a sample application.
if the bug is caused by a specific file (image, font, sound, level, please upload it as an attachment
The text was updated successfully, but these errors were encountered: