[AD] Fw: Acquire/Release speed issue |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
----- Original Message ----- From: "Robert Jr Ohannessian" <rohannessian@xxxxxxxxxx> To: "Eric Botcazou" <ebotcazou@xxxxxxxxxx> Sent: Tuesday, December 30, 2003 10:25 PM Subject: Acquire/Release speed issue > > Hi, > > (Could you pls forward this to [AD]? Thanks) > > I have noticed something strange with the acquire/release speed of > various bitmaps. Have a look at the attached test program. > > On my GeForce4 MX, I get the following result: > > Windowed mode: > $ ./temp.exe > screen: 1844 ticks > video: 516 ticks > sub-screen: 1844 ticks > video2: 485 ticks > > Basically, create a video bitmap covering most of the screen, and > locking that is way faster than locking the equivalent screen subbitmap. > > This leads me to believe there's a way to cut down on the > acquire/release overhead by a factor of 3 somewhere in here (unless, of > course, this is a bug). > > > Full-screen mode: > screen: 7157 ticks > video: 4484 ticks > sub-screen: 6859 ticks > video2: 4735 ticks > > Here, FS is waaay slower than windowed mode(!). However, the same > pattern can be seen: locking a video bitmap covering most of the screen > is still faster than a sub-bitmap or the screen itself. > > Any ideas on what's going on? > > ---------------------------------------------------------------------------- ---- > #include <time.h> > #include "allegro.h" > > int main() { > > clock_t t0, t1, t2, t3, t4, t5; > int i; > > allegro_init(); > set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); > > BITMAP *bmp1 = create_video_bitmap(640, 480); > BITMAP *bmp2 = create_video_bitmap(640, 479); > BITMAP *bmp3 = create_sub_bitmap(bmp1, 0, 0, 640, 479); > > t0 = clock(); > for (i = 0; i < 1000000; i++) { > acquire_bitmap(bmp1); > release_bitmap(bmp1); > } > t1 = clock(); > > for (i = 0; i < 1000000; i++) { > acquire_bitmap(bmp2); > release_bitmap(bmp2); > } > t2 = clock(); > > for (i = 0; i < 1000000; i++) { > acquire_bitmap(bmp3); > release_bitmap(bmp3); > } > t3 = clock(); > > destroy_bitmap(bmp3); > destroy_bitmap(bmp2); > destroy_bitmap(bmp1); > > set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); > set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0); > bmp1 = create_video_bitmap(640, 479); > > t4 = clock(); > for (i = 0; i < 1000000; i++) { > acquire_bitmap(bmp1); > release_bitmap(bmp1); > } > t5 = clock(); > > destroy_bitmap(bmp1); > set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); > set_gfx_mode(GFX_TEXT, 0, 0, 0, 0); > > printf("screen: %i ticks\n", t1 - t0); > printf("video: %i ticks\n", t2 - t1); > printf("sub-screen: %i ticks\n", t3 - t2); > printf("video2: %i ticks\n", t5 - t4); > return 0; > } > END_OF_MAIN() > > -- Eric Botcazou
Attachment:
temp.c
Description: Binary data
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |