mixer.quit() very slow

Issue #83 resolved
weeble created an issue

Pygame takes over 2 seconds to quit for me, and pretty much all this time is taken in mixer.quit(). This is pretty frustrating when starting and stopping my game a lot for debugging.


import pygame from time import time pygame.init() (6, 0) t1=time();pygame.quit();print time()-t1 2.15260004997</code> }}}


pygame.init() t1=time();pygame.mixer.quit();print time()-t1 2.28296613693 t1=time();pygame.quit();print time()-t1 0.00190806388855 }}}

I don't think I get this on Windows, only on Linux, although I only have a Linux machine to hand right now.

I'm running on Ubuntu 10.10. SDL version is 1.2.14. I built pygame from the hg repository today and still see this behaviour.

{{{ $ uname -a Linux dischord 2.6.35-30-generic #59-Ubuntu SMP Tue Aug 30 19:00:03 UTC 2011 x86_64 GNU/Linux }}}

Comments (6)

  1. René Dudfield


    this is an SDL issue. I can't find the sdl bug link, but I know it has been fixed by SDL.

    You should be able to try using a different audio driver to see if that helps?

    You can try putting one of these in your .bash_profile perhaps one of them will solve the problem for you.

    export SDL_AUDIODRIVER=alsa
    export SDL_AUDIODRIVER=dsp
    export SDL_AUDIODRIVER=null
    export SDL_AUDIODRIVER=pulseaudio


  2. Lenard Lindstrom

    Fix unit test execution for Python 3.2 ( closes #83 )

    The pygame.tests.testutils.async_sub module sets the stdout pipe to O_NONBLOCK. Yet for linux a pipe set as O_NONBLOCK returns immediately from a select call, even with nothing to read. This mucks up the Python 3.2 pipe read, which expects something, and fails (a bug) when there is nothing.

    Setting a socket to O_NONBLOCK is a good idea. A remote connection may have a transmission error, which may trigger the select statement to return, but subsequently invalidate the data so 0 bytes are returned on a read. But a pipe, in this case, is inter-task; there should be no transmission errors. Therefore the O_NONBLOCK should be unnecessary, and safely removed.


  3. Log in to comment