CircuitSacul
CircuitSacul

Reputation: 1850

PyGame slower on macOS than on Ubuntu or Raspbian

I use PyGame for creating games, but I noticed that the programs ran a lot slower on macOS than on my Raspberry Pi. My original solution was to install Ubuntu alongside macOS on my computer, and that worked. However, I would rather only have one operating system on my computer. Does anyone know why PyGame is so much slower on my mac when running macOS?

If it would help, I can send code. However, I have multiple PyGame programs and they all do the exact same thing, so I figured that it was most likely not the fault of the code, but I could be wrong.

Any help is appreciated, thanks.

P.S. When I say slower, I mean that it is running at about 30% of the speed on macOS than it would on Ubuntu.

Upvotes: 6

Views: 602

Answers (3)

user13564783
user13564783

Reputation:

MacOS is generally slower

Unless you can install a second RAM stick it will always be that way

Upvotes: -1

kmaork
kmaork

Reputation: 6022

Pygame is based on the SDL library. It supports using various rendering backends, such as OpenGL and metal. According to this answer (and the comment), it seems that the metal renderer might perform poorly on mac. Sadly, according to this issue, it seems that in most versions of pygame, it uses metal as the SDL backend for mac, and provides no way to change that.

There is the pygame.OPENGL flag you could pass to pygame.display.set_mode(), but I'm not sure exactly how it would affect anything. It might be a good idea to play with the other flags listed here.

I'd recommend you to open an issue on pygame's official github repo with the necessary details. Also, as a workaround, you could clone pygame, change the default renderer on mac to OpenGL, compile, and see if it improves anything. You can use the issue I mentioned above to understand where you should start.

Upvotes: 2

omar-h-omar
omar-h-omar

Reputation: 84

Try running your game in full screen mode

pygame.display.set_mode((0, 0), pygame.FULLSCREEN)

Upvotes: 1

Related Questions