Related older topic: https://www.allegro.cc/forums/thread/615015
So I had this problem with performance, the game spent more and more time in the al_flip, and the time was also kind of random, but it could go up to 50ms.
After some investigation, I found out, the time is spent in the _al_d3d_prepare_bitmaps_for_reset that is called every flip, and goes through all of the (tens of thousands) sub-bitmaps we have just to find out it doesn't need to be updated.
More info in the version of the code we use now.
To avoid problems, I'm calling the _al_d3d_prepare_bitmaps_for_reset once all the game graphics is loaded, so the game bitmaps are preserved, but for the rest of the bitmaps, they are preserved manually.
The question is, is there something special I should be aware of?
Haha, wow, I'd never have thought that would become a performance bottleneck. Yes, what you're doing should be okay.
I should note that for the past 1 or 2 versions of 5.1, display->bitmaps no longer contains sub-bitmaps.
Thx for the info.