|
clear / rectfill performance |
CGamesPlay
Member #2,559
July 2002
|
Okay, I've written a test to compare the performance of clear(screen) versus a rectfill over the entire screen. Logic dictates that clear(screen) should be faster or equal, but practice differs.
Qty. function msec usec/call 3000 rectfill 6729 2243 3000 clear(screen) 8975 2991 gfx_driver->name = X11 fullscreen Why is this? What are others results? -- Ryan Patterson - <http://cgamesplay.com/> |
gnolam
Member #2,030
March 2002
|
So what are the results with a civilized color depth? -- |
CGamesPlay
Member #2,559
July 2002
|
Even more pronounced. At 16 bpp: Qty. function msec usec/call 3000 rectfill 4099 1366 3000 clear(screen) 8857 2952 gfx_driver->name = X11 fullscreen
-- Ryan Patterson - <http://cgamesplay.com/> |
HoHo
Member #4,534
April 2004
|
But what about 32bit? __________ |
Matthew Leverton
Supreme Loser
January 1999
|
At 640x480, timing for roughly 1 second. Driver cd rect clear ------------------------------------------ DirectDraw window 32-bit 940 941 DirectDraw window 24-bit 688 688 DirectDraw window 16-bit 789 791 DirectDraw window 15-bit 781 789 DirectDraw window 8-bit 959 957 DirectDraw accel 32-bit 2905 2905 DirectDraw accel 16-bit 5498 5517 DirectDraw accel 8-bit 10575 10848
|
juvinious
Member #5,145
October 2004
|
Here I told cgames earlier I was going to give him a modified one with qpc for windows so here:
On linux: Output from windows, but it could be off because of being in virtualbox: Now windows guys can get in on the action, hopefully that qpc stuff is correct if not, somebody can correct it __________________________________________ |
Neil Walker
Member #210
April 2000
|
Why would anyone want to clear the screen directly and frequently? surely as a meaningful test you should be performing it on a offscreen/memory buffer. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
CGamesPlay
Member #2,559
July 2002
|
Quote: surely as a meaningful test I'm testing it because the issue came up. -- Ryan Patterson - <http://cgamesplay.com/> |
Elias
Member #358
May 2000
|
I did some timing here in linux (timing CPU time using clock) and results are (with C-only version of Allegro): clearing a 640x480 32bit bitmap: rectfill: 2427.2 / sec clear: 2457.0 / sec memset: 2525.3 / sec clearing a 16x16 32bit bitmap: rectfill: 1008064.5 / sec clear: 1901140.7 / sec memset: 4784689.0 / sec So, my conclusion would be, rectfill and clear have about the same performance on memory bitmaps normally (the difference for 640x480 is like 1% so probably far below the error margin of my test), and they do very well as even memset doesn't really do better. In the 16x16 test then, I did measure much more the various overheads than anything else, so memset wins clearly being twice as fast as clear (which has to do vtable access for each call and so on) being again twice as fast as rectfill (probably also has to do clipping checks additionally, maybe even calls hline for each line or something). But the relevant test, clearing the 640x480 bitmap, it really doesn't matter at all which of the three to use. -- |
|