Pygame simple loop runs very slowly on Mac
E: After testing the same on OS X and Linux, I can confirm that the following only happens on OS X. On Linux it literally runs at a thousand fps, as I happened to wonder. Any explanation? I would much prefer developing on Mac, thanks to TextMate.
Here's a simple loop that does almost nothing, and still runs very slowly. Can anyone explain why? FPS averages at little over 30, it takes a little over 30ms for each pass over the loop. Window size does not seem to affect this at all, as even setting a tiny window size like (50,50) has the same fps.
I find this weird, I would expect that any contemporary hardware could do a thousand fps for such a simple loop, even when we update every pixel every time. From the profile I can see that {built-in method get} and {built-in method update} combined seem to take around 30ms of time per call, is that really the best we can get out without using dirty rects?
pygame.init()
clock = pygame.time.Clock()
fps = 1000
#milliseconds from last frame
new_time, old_time = None, None
done = False
while not done:
clock.tick(fps)
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
# show fps and milliseconds
if new_time:
old_time = new_time
new_time = pygame.time.get_ticks()
if new_time and old_time:
pygame.display.set_caption("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time))
pygame.display.update()
Here's the beginning of a cProfile of the main function.
94503 function calls (92211 primitive calls) in 21.011 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.026 0.026 21.011 21.011 new_main.py:34(main)
652 14.048 0.022 14.048 0.022 {built-in method get}
652 5.864 0.009 5.864 0.009 {built-in method update}
1 0.444 0.444 0.634 0.634 {built-in method init}
651 0.278 0.000 0.278 0.000 {built-in method set_caption}
72/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:2234(_find_and_load)
72/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:2207(_find_and_load_unlocked)
71/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1186(_load_unlocked)
46/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1122(_exec)
46/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1465(exec_module)
74/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:313(_call_with_frames_removed)
54/1 0.004 0.000 0.151 0.151 {built-in method exec}
1 0.000 0.000 0.151 0.151 macosx.py:1(<module>)
1 0.000 0.000 0.150 0.150 pkgdata.py:18(<module>)
25/3 0.000 0.000 0.122 0.041 <frozen importlib._bootstrap>:1156(_load_backward_compatible)
8/1 0.026 0.003 0.121 0.121 {method 'load_module' of 'zipimport.zipimporter' objects}
1 0.000 0.000 0.101 0.101 __init__.py:15(<module>)
1 0.000 0.000 0.079 0.079 config_reader.py:115(build_from_config)
2 0.000 0.000 0.056 0.028 common.py:43(reset_screen)
2 0.055 0.027 0.055 0.027 {built-in method set_mode}
72/71 0.001 0.000 0.045 0.001 <frozen importlib._bootstrap>:2147(_find_spec)
70/69 0.000 0.000 0.043 0.001 <frozen importlib._bootstrap>:1934(find_spec)
70/69 0.001 0.000 0.043 0.001 <frozen importlib._bootstrap>:1902(_get_spec)
92 0.041 0.000 0.041 0.000 {built-in method load_extended}
6 0.000 0.000 0.041 0.007 new_map.py:74(add_character)
6 0.000 0.000 0.041 0.007 new_character.py:32(added_to_map)
6 0.001 0.000 0.041 0.007 new_character.py:265(__init__)
1 0.000 0.000 0.038 0.038 macosx.py:14(Video_AutoInit)
1 0.038 0.038 0.038 0.038 {built-in method InstallNSApplication}
1 0.036 0.036 0.036 0.036 {built-in method quit}
65 0.001 0.000 0.036 0.001 re.py:277(_compile)
49 0.000 0.000 0.036 0.001 re.py:221(compile)
python-3.x pygame
|
show 3 more comments
E: After testing the same on OS X and Linux, I can confirm that the following only happens on OS X. On Linux it literally runs at a thousand fps, as I happened to wonder. Any explanation? I would much prefer developing on Mac, thanks to TextMate.
Here's a simple loop that does almost nothing, and still runs very slowly. Can anyone explain why? FPS averages at little over 30, it takes a little over 30ms for each pass over the loop. Window size does not seem to affect this at all, as even setting a tiny window size like (50,50) has the same fps.
I find this weird, I would expect that any contemporary hardware could do a thousand fps for such a simple loop, even when we update every pixel every time. From the profile I can see that {built-in method get} and {built-in method update} combined seem to take around 30ms of time per call, is that really the best we can get out without using dirty rects?
pygame.init()
clock = pygame.time.Clock()
fps = 1000
#milliseconds from last frame
new_time, old_time = None, None
done = False
while not done:
clock.tick(fps)
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
# show fps and milliseconds
if new_time:
old_time = new_time
new_time = pygame.time.get_ticks()
if new_time and old_time:
pygame.display.set_caption("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time))
pygame.display.update()
Here's the beginning of a cProfile of the main function.
94503 function calls (92211 primitive calls) in 21.011 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.026 0.026 21.011 21.011 new_main.py:34(main)
652 14.048 0.022 14.048 0.022 {built-in method get}
652 5.864 0.009 5.864 0.009 {built-in method update}
1 0.444 0.444 0.634 0.634 {built-in method init}
651 0.278 0.000 0.278 0.000 {built-in method set_caption}
72/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:2234(_find_and_load)
72/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:2207(_find_and_load_unlocked)
71/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1186(_load_unlocked)
46/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1122(_exec)
46/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1465(exec_module)
74/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:313(_call_with_frames_removed)
54/1 0.004 0.000 0.151 0.151 {built-in method exec}
1 0.000 0.000 0.151 0.151 macosx.py:1(<module>)
1 0.000 0.000 0.150 0.150 pkgdata.py:18(<module>)
25/3 0.000 0.000 0.122 0.041 <frozen importlib._bootstrap>:1156(_load_backward_compatible)
8/1 0.026 0.003 0.121 0.121 {method 'load_module' of 'zipimport.zipimporter' objects}
1 0.000 0.000 0.101 0.101 __init__.py:15(<module>)
1 0.000 0.000 0.079 0.079 config_reader.py:115(build_from_config)
2 0.000 0.000 0.056 0.028 common.py:43(reset_screen)
2 0.055 0.027 0.055 0.027 {built-in method set_mode}
72/71 0.001 0.000 0.045 0.001 <frozen importlib._bootstrap>:2147(_find_spec)
70/69 0.000 0.000 0.043 0.001 <frozen importlib._bootstrap>:1934(find_spec)
70/69 0.001 0.000 0.043 0.001 <frozen importlib._bootstrap>:1902(_get_spec)
92 0.041 0.000 0.041 0.000 {built-in method load_extended}
6 0.000 0.000 0.041 0.007 new_map.py:74(add_character)
6 0.000 0.000 0.041 0.007 new_character.py:32(added_to_map)
6 0.001 0.000 0.041 0.007 new_character.py:265(__init__)
1 0.000 0.000 0.038 0.038 macosx.py:14(Video_AutoInit)
1 0.038 0.038 0.038 0.038 {built-in method InstallNSApplication}
1 0.036 0.036 0.036 0.036 {built-in method quit}
65 0.001 0.000 0.036 0.001 re.py:277(_compile)
49 0.000 0.000 0.036 0.001 re.py:221(compile)
python-3.x pygame
Even without the update call, my mac will only go to 60 fps.
– jgritty
Apr 23 '15 at 21:39
Changing theset_captionto a print like:print ("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time))gets me to 60 fps also.
– jgritty
Apr 23 '15 at 21:41
Also, why isn't 60 fps fast enough? Your monitor probably can't display any faster than that.
– jgritty
Apr 23 '15 at 21:48
Just for fun, I tried it in a Windows 7 VM using Fusion, and it was limited to 62 fps. I don't have a linux machine with pygame to experiment, but I'm guessing it's just lying to you in some fashion.
– jgritty
Apr 23 '15 at 22:02
Some fps being enough is not the point. The point is, if it only runs even at 60fps, there seems to be something wrong. It should be running at much higher fps, in my opinion.
– Roope
Apr 24 '15 at 5:25
|
show 3 more comments
E: After testing the same on OS X and Linux, I can confirm that the following only happens on OS X. On Linux it literally runs at a thousand fps, as I happened to wonder. Any explanation? I would much prefer developing on Mac, thanks to TextMate.
Here's a simple loop that does almost nothing, and still runs very slowly. Can anyone explain why? FPS averages at little over 30, it takes a little over 30ms for each pass over the loop. Window size does not seem to affect this at all, as even setting a tiny window size like (50,50) has the same fps.
I find this weird, I would expect that any contemporary hardware could do a thousand fps for such a simple loop, even when we update every pixel every time. From the profile I can see that {built-in method get} and {built-in method update} combined seem to take around 30ms of time per call, is that really the best we can get out without using dirty rects?
pygame.init()
clock = pygame.time.Clock()
fps = 1000
#milliseconds from last frame
new_time, old_time = None, None
done = False
while not done:
clock.tick(fps)
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
# show fps and milliseconds
if new_time:
old_time = new_time
new_time = pygame.time.get_ticks()
if new_time and old_time:
pygame.display.set_caption("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time))
pygame.display.update()
Here's the beginning of a cProfile of the main function.
94503 function calls (92211 primitive calls) in 21.011 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.026 0.026 21.011 21.011 new_main.py:34(main)
652 14.048 0.022 14.048 0.022 {built-in method get}
652 5.864 0.009 5.864 0.009 {built-in method update}
1 0.444 0.444 0.634 0.634 {built-in method init}
651 0.278 0.000 0.278 0.000 {built-in method set_caption}
72/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:2234(_find_and_load)
72/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:2207(_find_and_load_unlocked)
71/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1186(_load_unlocked)
46/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1122(_exec)
46/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1465(exec_module)
74/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:313(_call_with_frames_removed)
54/1 0.004 0.000 0.151 0.151 {built-in method exec}
1 0.000 0.000 0.151 0.151 macosx.py:1(<module>)
1 0.000 0.000 0.150 0.150 pkgdata.py:18(<module>)
25/3 0.000 0.000 0.122 0.041 <frozen importlib._bootstrap>:1156(_load_backward_compatible)
8/1 0.026 0.003 0.121 0.121 {method 'load_module' of 'zipimport.zipimporter' objects}
1 0.000 0.000 0.101 0.101 __init__.py:15(<module>)
1 0.000 0.000 0.079 0.079 config_reader.py:115(build_from_config)
2 0.000 0.000 0.056 0.028 common.py:43(reset_screen)
2 0.055 0.027 0.055 0.027 {built-in method set_mode}
72/71 0.001 0.000 0.045 0.001 <frozen importlib._bootstrap>:2147(_find_spec)
70/69 0.000 0.000 0.043 0.001 <frozen importlib._bootstrap>:1934(find_spec)
70/69 0.001 0.000 0.043 0.001 <frozen importlib._bootstrap>:1902(_get_spec)
92 0.041 0.000 0.041 0.000 {built-in method load_extended}
6 0.000 0.000 0.041 0.007 new_map.py:74(add_character)
6 0.000 0.000 0.041 0.007 new_character.py:32(added_to_map)
6 0.001 0.000 0.041 0.007 new_character.py:265(__init__)
1 0.000 0.000 0.038 0.038 macosx.py:14(Video_AutoInit)
1 0.038 0.038 0.038 0.038 {built-in method InstallNSApplication}
1 0.036 0.036 0.036 0.036 {built-in method quit}
65 0.001 0.000 0.036 0.001 re.py:277(_compile)
49 0.000 0.000 0.036 0.001 re.py:221(compile)
python-3.x pygame
E: After testing the same on OS X and Linux, I can confirm that the following only happens on OS X. On Linux it literally runs at a thousand fps, as I happened to wonder. Any explanation? I would much prefer developing on Mac, thanks to TextMate.
Here's a simple loop that does almost nothing, and still runs very slowly. Can anyone explain why? FPS averages at little over 30, it takes a little over 30ms for each pass over the loop. Window size does not seem to affect this at all, as even setting a tiny window size like (50,50) has the same fps.
I find this weird, I would expect that any contemporary hardware could do a thousand fps for such a simple loop, even when we update every pixel every time. From the profile I can see that {built-in method get} and {built-in method update} combined seem to take around 30ms of time per call, is that really the best we can get out without using dirty rects?
pygame.init()
clock = pygame.time.Clock()
fps = 1000
#milliseconds from last frame
new_time, old_time = None, None
done = False
while not done:
clock.tick(fps)
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
# show fps and milliseconds
if new_time:
old_time = new_time
new_time = pygame.time.get_ticks()
if new_time and old_time:
pygame.display.set_caption("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time))
pygame.display.update()
Here's the beginning of a cProfile of the main function.
94503 function calls (92211 primitive calls) in 21.011 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.026 0.026 21.011 21.011 new_main.py:34(main)
652 14.048 0.022 14.048 0.022 {built-in method get}
652 5.864 0.009 5.864 0.009 {built-in method update}
1 0.444 0.444 0.634 0.634 {built-in method init}
651 0.278 0.000 0.278 0.000 {built-in method set_caption}
72/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:2234(_find_and_load)
72/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:2207(_find_and_load_unlocked)
71/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1186(_load_unlocked)
46/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1122(_exec)
46/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:1465(exec_module)
74/1 0.000 0.000 0.151 0.151 <frozen importlib._bootstrap>:313(_call_with_frames_removed)
54/1 0.004 0.000 0.151 0.151 {built-in method exec}
1 0.000 0.000 0.151 0.151 macosx.py:1(<module>)
1 0.000 0.000 0.150 0.150 pkgdata.py:18(<module>)
25/3 0.000 0.000 0.122 0.041 <frozen importlib._bootstrap>:1156(_load_backward_compatible)
8/1 0.026 0.003 0.121 0.121 {method 'load_module' of 'zipimport.zipimporter' objects}
1 0.000 0.000 0.101 0.101 __init__.py:15(<module>)
1 0.000 0.000 0.079 0.079 config_reader.py:115(build_from_config)
2 0.000 0.000 0.056 0.028 common.py:43(reset_screen)
2 0.055 0.027 0.055 0.027 {built-in method set_mode}
72/71 0.001 0.000 0.045 0.001 <frozen importlib._bootstrap>:2147(_find_spec)
70/69 0.000 0.000 0.043 0.001 <frozen importlib._bootstrap>:1934(find_spec)
70/69 0.001 0.000 0.043 0.001 <frozen importlib._bootstrap>:1902(_get_spec)
92 0.041 0.000 0.041 0.000 {built-in method load_extended}
6 0.000 0.000 0.041 0.007 new_map.py:74(add_character)
6 0.000 0.000 0.041 0.007 new_character.py:32(added_to_map)
6 0.001 0.000 0.041 0.007 new_character.py:265(__init__)
1 0.000 0.000 0.038 0.038 macosx.py:14(Video_AutoInit)
1 0.038 0.038 0.038 0.038 {built-in method InstallNSApplication}
1 0.036 0.036 0.036 0.036 {built-in method quit}
65 0.001 0.000 0.036 0.001 re.py:277(_compile)
49 0.000 0.000 0.036 0.001 re.py:221(compile)
python-3.x pygame
python-3.x pygame
edited Apr 23 '15 at 21:21
Roope
asked Apr 23 '15 at 21:04
RoopeRoope
3,34211342
3,34211342
Even without the update call, my mac will only go to 60 fps.
– jgritty
Apr 23 '15 at 21:39
Changing theset_captionto a print like:print ("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time))gets me to 60 fps also.
– jgritty
Apr 23 '15 at 21:41
Also, why isn't 60 fps fast enough? Your monitor probably can't display any faster than that.
– jgritty
Apr 23 '15 at 21:48
Just for fun, I tried it in a Windows 7 VM using Fusion, and it was limited to 62 fps. I don't have a linux machine with pygame to experiment, but I'm guessing it's just lying to you in some fashion.
– jgritty
Apr 23 '15 at 22:02
Some fps being enough is not the point. The point is, if it only runs even at 60fps, there seems to be something wrong. It should be running at much higher fps, in my opinion.
– Roope
Apr 24 '15 at 5:25
|
show 3 more comments
Even without the update call, my mac will only go to 60 fps.
– jgritty
Apr 23 '15 at 21:39
Changing theset_captionto a print like:print ("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time))gets me to 60 fps also.
– jgritty
Apr 23 '15 at 21:41
Also, why isn't 60 fps fast enough? Your monitor probably can't display any faster than that.
– jgritty
Apr 23 '15 at 21:48
Just for fun, I tried it in a Windows 7 VM using Fusion, and it was limited to 62 fps. I don't have a linux machine with pygame to experiment, but I'm guessing it's just lying to you in some fashion.
– jgritty
Apr 23 '15 at 22:02
Some fps being enough is not the point. The point is, if it only runs even at 60fps, there seems to be something wrong. It should be running at much higher fps, in my opinion.
– Roope
Apr 24 '15 at 5:25
Even without the update call, my mac will only go to 60 fps.
– jgritty
Apr 23 '15 at 21:39
Even without the update call, my mac will only go to 60 fps.
– jgritty
Apr 23 '15 at 21:39
Changing the
set_caption to a print like: print ("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time)) gets me to 60 fps also.– jgritty
Apr 23 '15 at 21:41
Changing the
set_caption to a print like: print ("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time)) gets me to 60 fps also.– jgritty
Apr 23 '15 at 21:41
Also, why isn't 60 fps fast enough? Your monitor probably can't display any faster than that.
– jgritty
Apr 23 '15 at 21:48
Also, why isn't 60 fps fast enough? Your monitor probably can't display any faster than that.
– jgritty
Apr 23 '15 at 21:48
Just for fun, I tried it in a Windows 7 VM using Fusion, and it was limited to 62 fps. I don't have a linux machine with pygame to experiment, but I'm guessing it's just lying to you in some fashion.
– jgritty
Apr 23 '15 at 22:02
Just for fun, I tried it in a Windows 7 VM using Fusion, and it was limited to 62 fps. I don't have a linux machine with pygame to experiment, but I'm guessing it's just lying to you in some fashion.
– jgritty
Apr 23 '15 at 22:02
Some fps being enough is not the point. The point is, if it only runs even at 60fps, there seems to be something wrong. It should be running at much higher fps, in my opinion.
– Roope
Apr 24 '15 at 5:25
Some fps being enough is not the point. The point is, if it only runs even at 60fps, there seems to be something wrong. It should be running at much higher fps, in my opinion.
– Roope
Apr 24 '15 at 5:25
|
show 3 more comments
2 Answers
2
active
oldest
votes
The answer to this ended up being that the retina display under OS X is the differentiating factor. Running it even on an external display on the same Mac works fine. But moving the window to the retina display makes it sluggish. With or without an external monitor connected.
On the other hand, it runs just fine on the same retina display under Linux. It is unclear what the difference in the display managers / rendering is that causes this, but I doubt there is anything one could do about it.
1
We have the exact same problem. Have you ever found a solution to solve this so games will run smooth on the macbook screen itself aswell?
– Merijn dk
Oct 14 '15 at 20:25
@Merijndk As far as I know, there's know change in the situation, unfortunately. Still don't know why it happens either.
– Roope
Oct 14 '15 at 20:36
well it kind of makes sense since the screen size on ratina is huge. The problem is that python overall is pretty slow on mac. Where i run our app on linux and windows 250fps easily my friends pretty new macbook runs it at 60fps max. Also python will use 100% of his cpu while on my windows it is only 10%. Hope they fix it soon
– Merijn dk
Oct 20 '15 at 14:19
add a comment |
Changing the game resolution to fullscreen helped me.
Try this:
window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
instead of:
window = pygame.display.set_mode((winx, winy))
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29834292%2fpygame-simple-loop-runs-very-slowly-on-mac%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
The answer to this ended up being that the retina display under OS X is the differentiating factor. Running it even on an external display on the same Mac works fine. But moving the window to the retina display makes it sluggish. With or without an external monitor connected.
On the other hand, it runs just fine on the same retina display under Linux. It is unclear what the difference in the display managers / rendering is that causes this, but I doubt there is anything one could do about it.
1
We have the exact same problem. Have you ever found a solution to solve this so games will run smooth on the macbook screen itself aswell?
– Merijn dk
Oct 14 '15 at 20:25
@Merijndk As far as I know, there's know change in the situation, unfortunately. Still don't know why it happens either.
– Roope
Oct 14 '15 at 20:36
well it kind of makes sense since the screen size on ratina is huge. The problem is that python overall is pretty slow on mac. Where i run our app on linux and windows 250fps easily my friends pretty new macbook runs it at 60fps max. Also python will use 100% of his cpu while on my windows it is only 10%. Hope they fix it soon
– Merijn dk
Oct 20 '15 at 14:19
add a comment |
The answer to this ended up being that the retina display under OS X is the differentiating factor. Running it even on an external display on the same Mac works fine. But moving the window to the retina display makes it sluggish. With or without an external monitor connected.
On the other hand, it runs just fine on the same retina display under Linux. It is unclear what the difference in the display managers / rendering is that causes this, but I doubt there is anything one could do about it.
1
We have the exact same problem. Have you ever found a solution to solve this so games will run smooth on the macbook screen itself aswell?
– Merijn dk
Oct 14 '15 at 20:25
@Merijndk As far as I know, there's know change in the situation, unfortunately. Still don't know why it happens either.
– Roope
Oct 14 '15 at 20:36
well it kind of makes sense since the screen size on ratina is huge. The problem is that python overall is pretty slow on mac. Where i run our app on linux and windows 250fps easily my friends pretty new macbook runs it at 60fps max. Also python will use 100% of his cpu while on my windows it is only 10%. Hope they fix it soon
– Merijn dk
Oct 20 '15 at 14:19
add a comment |
The answer to this ended up being that the retina display under OS X is the differentiating factor. Running it even on an external display on the same Mac works fine. But moving the window to the retina display makes it sluggish. With or without an external monitor connected.
On the other hand, it runs just fine on the same retina display under Linux. It is unclear what the difference in the display managers / rendering is that causes this, but I doubt there is anything one could do about it.
The answer to this ended up being that the retina display under OS X is the differentiating factor. Running it even on an external display on the same Mac works fine. But moving the window to the retina display makes it sluggish. With or without an external monitor connected.
On the other hand, it runs just fine on the same retina display under Linux. It is unclear what the difference in the display managers / rendering is that causes this, but I doubt there is anything one could do about it.
answered Jun 4 '15 at 18:16
RoopeRoope
3,34211342
3,34211342
1
We have the exact same problem. Have you ever found a solution to solve this so games will run smooth on the macbook screen itself aswell?
– Merijn dk
Oct 14 '15 at 20:25
@Merijndk As far as I know, there's know change in the situation, unfortunately. Still don't know why it happens either.
– Roope
Oct 14 '15 at 20:36
well it kind of makes sense since the screen size on ratina is huge. The problem is that python overall is pretty slow on mac. Where i run our app on linux and windows 250fps easily my friends pretty new macbook runs it at 60fps max. Also python will use 100% of his cpu while on my windows it is only 10%. Hope they fix it soon
– Merijn dk
Oct 20 '15 at 14:19
add a comment |
1
We have the exact same problem. Have you ever found a solution to solve this so games will run smooth on the macbook screen itself aswell?
– Merijn dk
Oct 14 '15 at 20:25
@Merijndk As far as I know, there's know change in the situation, unfortunately. Still don't know why it happens either.
– Roope
Oct 14 '15 at 20:36
well it kind of makes sense since the screen size on ratina is huge. The problem is that python overall is pretty slow on mac. Where i run our app on linux and windows 250fps easily my friends pretty new macbook runs it at 60fps max. Also python will use 100% of his cpu while on my windows it is only 10%. Hope they fix it soon
– Merijn dk
Oct 20 '15 at 14:19
1
1
We have the exact same problem. Have you ever found a solution to solve this so games will run smooth on the macbook screen itself aswell?
– Merijn dk
Oct 14 '15 at 20:25
We have the exact same problem. Have you ever found a solution to solve this so games will run smooth on the macbook screen itself aswell?
– Merijn dk
Oct 14 '15 at 20:25
@Merijndk As far as I know, there's know change in the situation, unfortunately. Still don't know why it happens either.
– Roope
Oct 14 '15 at 20:36
@Merijndk As far as I know, there's know change in the situation, unfortunately. Still don't know why it happens either.
– Roope
Oct 14 '15 at 20:36
well it kind of makes sense since the screen size on ratina is huge. The problem is that python overall is pretty slow on mac. Where i run our app on linux and windows 250fps easily my friends pretty new macbook runs it at 60fps max. Also python will use 100% of his cpu while on my windows it is only 10%. Hope they fix it soon
– Merijn dk
Oct 20 '15 at 14:19
well it kind of makes sense since the screen size on ratina is huge. The problem is that python overall is pretty slow on mac. Where i run our app on linux and windows 250fps easily my friends pretty new macbook runs it at 60fps max. Also python will use 100% of his cpu while on my windows it is only 10%. Hope they fix it soon
– Merijn dk
Oct 20 '15 at 14:19
add a comment |
Changing the game resolution to fullscreen helped me.
Try this:
window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
instead of:
window = pygame.display.set_mode((winx, winy))
add a comment |
Changing the game resolution to fullscreen helped me.
Try this:
window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
instead of:
window = pygame.display.set_mode((winx, winy))
add a comment |
Changing the game resolution to fullscreen helped me.
Try this:
window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
instead of:
window = pygame.display.set_mode((winx, winy))
Changing the game resolution to fullscreen helped me.
Try this:
window = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
instead of:
window = pygame.display.set_mode((winx, winy))
answered Nov 18 '18 at 20:07
Konstantin KoganKonstantin Kogan
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29834292%2fpygame-simple-loop-runs-very-slowly-on-mac%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Even without the update call, my mac will only go to 60 fps.
– jgritty
Apr 23 '15 at 21:39
Changing the
set_captionto a print like:print ("fps: " + str(int(clock.get_fps())) + " ms: " + str(new_time-old_time))gets me to 60 fps also.– jgritty
Apr 23 '15 at 21:41
Also, why isn't 60 fps fast enough? Your monitor probably can't display any faster than that.
– jgritty
Apr 23 '15 at 21:48
Just for fun, I tried it in a Windows 7 VM using Fusion, and it was limited to 62 fps. I don't have a linux machine with pygame to experiment, but I'm guessing it's just lying to you in some fashion.
– jgritty
Apr 23 '15 at 22:02
Some fps being enough is not the point. The point is, if it only runs even at 60fps, there seems to be something wrong. It should be running at much higher fps, in my opinion.
– Roope
Apr 24 '15 at 5:25