This kind of optimization can be used in Open GL for copying data to video card memory.
In this test let assume that we have simple bitmap structure designed as two dimensional byte array where each pixel have 256 possible colors.
To achieve best drawing speed it can be useful to use specialized bitmap structures and routines. Direct pixel access in libraries is generally slowed-down by more factors: This articles shows how to achieve a custom bitmap structure that is then copied to a TBitmap to render it on the screen.
Pixel type can be written in various ways to define its size and internal channel structure.
If memory block have to be copied to another memory place or device memory DMA(Direct Memory Access) can be used.
CPU doesn't have to be involved in copy operations and can do further processing.
It is good to have whole bitmap in one compact memory area.
Thanks to delayed draw execution with calling Redraw method drawing of frames could be skipped. I can store transparency and 16-bit values for each channel.
Internal structure is implemented as pointer to array of pointers to data because dynamic array is in fact pointer to array data.