Some graphic benchmarking
by
, 16-01-2011 at 02:45 PM (7615 Views)
So I was thinking, after going to all this trouble of making OpenGl work with Sdl in an easy interface - how much slower would it be than plain old sdl?
So I came up with two small little programs to test this out. Prometheus_Vid would go up against sdl_image and sdl. The challenge was simple: how many pixels of a png can each contestant blit in 1 second. The destination would be a 640x480 windows in 32 bit colour mode. No flags for sdl, no special performance modes for Prometheus. Simple. Because the results were outstanding to say the least, I will start with them:
So there you have it - the results. I did not flip the end result to save 1 line of code (its sunday - be lazy, but I think Prometheus would still be on top somewhowCode:426440000 prometheus pixels 023960000 sdl pixels 881200000 prometheus pixels 023960000 sdl pixels 475200000 prometheus pixels 023720000 sdl pixels prometheus average = 594280000 pixels sdl average = 023880000 pixels. My first impression after running each one once was one very surprised look - I mean 20x faster than SDL whhaaaat? so I ran it twice more: consistent results for sdl, for prometheus, it sort of depended on how much I moved the mouse (not sure why but there).
Also, I will thus supply the code for the benchmark programs:
Sdl Benchmark:
prometheus benchmark program:Code:program SdlBenchmark; uses sdl, sdl_image, png; var Data: pSdl_Surface; StartTime: Int64; Draws: Int64; Screen: pSdl_Surface; begin Sdl_Init(Sdl_Init_Everything); Screen := sdl_SetVideoMode(640, 480, 32, 0); Data := Img_Load('Img.png'); StartTime := sdl_GetTicks; Draws := 0; repeat sdl_blitsurface(Data, nil, Screen, nil); Draws := Draws + 1; until (sdl_GetTicks - StartTime) > 1000; writeln('DREW [',DRAWS,'] X [',Data^.w,'X',Data^.h,'] = [',Data^.w * Data^.h,']'); writeln('TOTAL [',Data^.w * Data^.h * Draws,'] PX'); end.
Conclusion: THIS IS SPARTAAAAACode:program PrometheusBenchmark; uses Prometheus_Vid, sdl; var Data: Image; StartTime: Int64; Draws: Int64; begin PrometheusVid_Start(); CreateWindow(640, 480, 32); Data.Load('Img.png'); StartTime := sdl_GetTicks; Draws := 0; repeat Data.Draw(0,0); Draws := Draws + 1; until (sdl_GetTicks - StartTime) > 1000; writeln('DREW [',DRAWS,'] X [',Data.GlWidth,'X',Data.GlHeight,'] = [',Data.GlWidth * Data.GlHeight,']'); writeln('TOTAL [',Data.GlWidth * Data.GlHeight * Draws,'] PX'); end.
for record, the prometheus version used is r27/28 (cannot be sure since kdesvn says its out of date why, I don't know but there. I expect both would perform the same since the drawing code is equal)
code_glitch
over and out in a blit![]()