Public bug reported: Binary package hint: libsdl1.2debian
Using some SDL applications on my Ubuntu Dapper installation (e-uae, some games) I recognized that SDL is VERY slow. I wrote a little test program that draws rectangles in a window for 5 seconds and counts the number of drawn rectangles. The program uses SDL and direkt X11 to compare the speed. I get the following results: On Ubuntu Dapper: X11: 100.000 rectangles in 5 seconds SDL: 750 rectangles in 5 secondes (yes, this is slower than good old Amiga 1000!) On SuSE 10.1: (same machine, just my old SuSE installation before I switched to Ubuntu): X11: 115.000 rectangles in 5 seconds SDL: 20.000 rectangles in 5 seconds So SDL seems to be much slower than directly drawing X11 rectangles. But 750 rectangles on Ubuntu is absolutly unacceptable. Here is the source of my little program: #include <stdio.h> #include <time.h> #include <unistd.h> #include <SDL/SDL.h> #include <X11/Xlib.h> #define MYWIDTH 1024 #define MYHEIGHT 768 #define RECSIZE 100 #define SECS 5 int main () { int i; time_t starttime; time_t stoptime; SDL_Surface *surface; const char *displayname = 0; Display *display; Window drawable; GC gc; printf ("Start\n"); SDL_Init (SDL_INIT_VIDEO); surface = SDL_SetVideoMode (MYWIDTH, MYHEIGHT, 0, 0); time (&starttime); for (i = 0;; i++) { SDL_Rect r; r.x = i % (MYWIDTH - RECSIZE); r.y = i % (MYHEIGHT - RECSIZE); r.w = RECSIZE; r.h = RECSIZE; int gun = i & 255; SDL_FillRect (surface, &r, SDL_MapRGB (surface->format, gun, gun, gun)); SDL_UpdateRect (surface, r.x, r.y, r.w, r.h); time (&stoptime); if (stoptime - starttime >= SECS) break; } time (&stoptime); printf ("SDL: Drawn %d rectangles in %ds\n", i, (int) (stoptime - starttime)); SDL_Quit (); display = XOpenDisplay (displayname); if (display == 0) { fprintf (stderr, "Failed to open X Display\n"); } else { drawable = XCreateWindow (display, DefaultRootWindow (display), 0, 0, MYWIDTH, MYHEIGHT, 0, CopyFromParent, CopyFromParent, CopyFromParent, 0, 0); XMapWindow(display,drawable); gc = XCreateGC (display, drawable, 0, 0); XSync(display, 0); XSetForeground(display, gc, 0); XFillRectangle(display, drawable, gc, 0, 0, MYWIDTH-1, MYHEIGHT-1); time (&starttime); for (i = 0;; i++) { int x = i % (MYWIDTH - RECSIZE); int y = i % (MYHEIGHT - RECSIZE); int w = RECSIZE; int h = RECSIZE; int gun = i & 255; unsigned long color = (gun << 16) | (gun << 8) | gun; XSetForeground (display, gc, color); XFillRectangle (display, drawable, gc, x, y, w, h); XSync(display,0); time(&stoptime); if (stoptime - starttime >= SECS) break; } time (&stoptime); printf ("X11: Drawn %d rectangles in %ds\n", i, (int) (stoptime - starttime)); } printf ("Stop\n"); return 0; } ** Affects: libsdl1.2 (Ubuntu) Importance: Untriaged Status: Unconfirmed -- SDL graphics is VERY slow on my Ubuntu Dapper installation https://launchpad.net/bugs/55168 -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs