[AD] optimization of create_video_bitmap()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]

The attached patch optimizes create_video_bitmap(). The old version
has a worst case of O(n^3), where n is the number of already existing
video bitmaps, and it seems that this cubic behavior is realized in
quite normal circumstances. The new version is O(n^2) in worst case,
and seems to be more like linear under normal circumstances. This
means that it's much faster to allocate many bitmaps, but the
improvement is smaller for few bitmaps. E.g., allocating a grid of
32x24 video bitmaps is 2300 times faster on my machine. I uploaded
my test program to http://home.student.uu.se/svsa1977/tmp/vidopt.zip
in case anyone is interested (Requires cvs version of adime; sorry
for this but it was much easier for me. See top of C file for

Sven Sandberg   svsa1977@xxxxxxxxxx   home.student.uu.se/svsa1977

Attachment: create_video_bitmap.diff.gz
Description: application/gzip

Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/